From 72792689336d026423531ace9a37cb00a37f367b Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Fri, 18 Jan 2019 20:45:45 +0100 Subject: [PATCH] Remove unlock Locks will be released on close. --- zathura/database-plain.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/zathura/database-plain.c b/zathura/database-plain.c index ee898b5..32609d3 100644 --- a/zathura/database-plain.c +++ b/zathura/database-plain.c @@ -667,7 +667,6 @@ zathura_db_read_key_file_from_file(const char* path) /* read config file */ file_lock_set(fileno(file), F_WRLCK); char* content = girara_file_read2(file); - file_lock_set(fileno(file), F_UNLCK); fclose(file); if (content == NULL) { g_key_file_free(key_file); @@ -733,8 +732,6 @@ zathura_db_write_key_file_to_file(const char* file, GKeyFile* key_file) if (write(fd, content, strlen(content)) == 0) { girara_error("Failed to write to %s", file); } - file_lock_set(fd, F_UNLCK); - close(fd); g_free(content); @@ -787,7 +784,6 @@ plain_io_read(GiraraInputHistoryIO* db) /* read input history file */ file_lock_set(fileno(file), F_RDLCK); char* content = girara_file_read2(file); - file_lock_set(fileno(file), F_UNLCK); fclose(file); girara_list_t* res = girara_list_new2(g_free); @@ -823,7 +819,6 @@ plain_io_append(GiraraInputHistoryIO* db, const char* input) rewind(file); if (ftruncate(fileno(file), 0) != 0) { free(content); - file_lock_set(fileno(file), F_UNLCK); fclose(file); return; } @@ -840,8 +835,6 @@ plain_io_append(GiraraInputHistoryIO* db, const char* input) } g_strfreev(tmp); fprintf(file, "%s\n", input); - - file_lock_set(fileno(file), F_UNLCK); fclose(file); }