]> git.scottworley.com Git - tl-append/blobdiff - tl-append-test.c
Also take flock locks
[tl-append] / tl-append-test.c
index 04c679e1b2d2e3b482a86c760b54a109650574ca..e712c6f9b9fd0cb8108cfe882e27562ec2f3f41e 100644 (file)
@@ -255,7 +255,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 +313,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();
 }