commit 22a05e81e35409b293911e699cca8d54f0807ff0
parent 81bd77a29a2ce6974198c24dbf7ea9468201f365
Author: Andrej Kacian <ticho@claws-mail.org>
Date: Fri, 19 Oct 2018 23:36:40 +0200
Rework debug output in passwd_store_set() to be less confusing.
Diffstat:
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/passwordstore.c b/src/passwordstore.c
@@ -155,16 +155,18 @@ gboolean passwd_store_set(PasswordBlockType block_type,
}
}
- debug_print("%s password for '%s' in block (%d/%s)%s\n",
- (p == NULL ? "Deleting" : "Storing"),
- password_id, block_type, block_name,
- (encrypted ? ", already encrypted" : "") );
-
if (p == NULL) {
/* NULL password was passed to us, so delete the entry with
- * corresponding id */
- g_hash_table_remove(block->entries, password_id);
+ * corresponding id, if it exists */
+ if (g_hash_table_lookup(block->entries, password_id) != NULL) {
+ debug_print("Deleting password for '%s' in block (%d/%s)\n",
+ password_id, block_type, block_name);
+ g_hash_table_remove(block->entries, password_id);
+ }
} else {
+ debug_print("Setting password for '%s' in block (%d/%s)%s\n",
+ password_id, block_type, block_name,
+ (encrypted ? ", already encrypted" : ""));
if (!encrypted) {
/* encrypt password before saving it */
if ((encrypted_password =