Remove unlock

Locks will be released on close.
This commit is contained in:
Sebastian Ramacher 2019-01-18 20:45:45 +01:00
parent cc39352485
commit 7279268933

View file

@ -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);
}