X-Git-Url: http://git.scottworley.com/tl-append/blobdiff_plain/a1160bb5b12b273f44860ccd4f028cb22c4f5e4d..9b76e9d2c7bdd413e36432b64a0022852a484dea:/tl-append-test.c diff --git a/tl-append-test.c b/tl-append-test.c index 04c679e..ee5d3f7 100644 --- a/tl-append-test.c +++ b/tl-append-test.c @@ -171,7 +171,7 @@ static void test_encode_time() { 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'); @@ -194,6 +194,7 @@ static void test_encode_time() { assert(encoded[17] == '1'); assert(encoded[18] == '6'); assert(encoded[19] == '\0'); + free(encoded); } static FILE *take_lock(FILE *f, char *lock_type) { @@ -255,7 +256,7 @@ static void write_and_read_two_lines() { 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++) @@ -313,7 +314,7 @@ int main() { 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(); }