summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordequis <dx@dxzone.com.ar>2018-03-28 22:40:17 -0300
committerdequis <dx@dxzone.com.ar>2018-03-28 22:40:17 -0300
commitb52cf1015eaa4d759c9377df35a56988655dce89 (patch)
tree91ca3dec26cfd9071274ddb61d0b318ed5d35bcd /src
parent8d07f52bae6fa7e85988125293f08a72e39de8c3 (diff)
downloadirssi-b52cf1015eaa4d759c9377df35a56988655dce89.zip
otr: add KEY_GEN_STARTED state to avoid starting it twice
Fun race condition there, got this when testing with the jabber xmlconsole open in bitlbee
Diffstat (limited to 'src')
-rw-r--r--src/otr/key.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/otr/key.c b/src/otr/key.c
index 4032b0b2..7fee4084 100644
--- a/src/otr/key.c
+++ b/src/otr/key.c
@@ -43,9 +43,10 @@
*/
enum key_gen_status {
KEY_GEN_IDLE = 0,
- KEY_GEN_RUNNING = 1,
- KEY_GEN_FINISHED = 2,
- KEY_GEN_ERROR = 3,
+ KEY_GEN_STARTED = 1,
+ KEY_GEN_RUNNING = 2,
+ KEY_GEN_FINISHED = 3,
+ KEY_GEN_ERROR = 4,
};
/*
@@ -208,6 +209,7 @@ void key_gen_run(struct otr_user_state *ustate, const char *account_name)
/* Make sure the pointer does not go away during the proess. */
key_gen_state.account_name = strdup(account_name);
key_gen_state.ustate = ustate;
+ key_gen_state.status = KEY_GEN_STARTED;
/* Creating key file path. */
key_gen_state.key_file_path = file_path_build(OTR_KEYFILE);