if (tt == (time_t)-1)
die_err("Can't pack time?");
- const char *encoded = encode_time(tt);
+ char *encoded = encode_time(tt);
/* Loose check to allow for daylight savings time changes between the current
* time and the target time. :( */
assert(encoded[0] == '2');
assert(encoded[17] == '1');
assert(encoded[18] == '6');
assert(encoded[19] == '\0');
+ free(encoded);
}
static FILE *take_lock(FILE *f, char *lock_type) {
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();
}