static void write_to_locked_log(char *lock_types[]) {
remove_logfile();
ex_t e1 = write_to_tl_append("begin\n");
- FILE *f = fopen(FILENAME, "a");
+ FILE *f = fopen(FILENAME, "ae");
if (f == NULL)
die_err("Couldn't open file for locking");
for (int i = 0; lock_types[i]; i++)
write_to_locked_log((char *[]){NULL});
write_to_locked_log((char *[]){"fcntl", NULL});
write_to_locked_log((char *[]){"flock", NULL});
- write_to_locked_log((char *[]){"flock", "fcntl", NULL});
+ write_to_locked_log((char *[]){"flock", "fcntl", NULL}); /* Deadlock risk! */
write_to_locked_log((char *[]){"fcntl", "flock", NULL});
write_concurrently();
}