fixed an issue where uzbl's fifo would not work if the fifo already existed
authoruranther <jwheaton@purdue.edu>
Wed, 3 Jun 2009 23:55:26 +0000 (19:55 -0400)
committeruranther <jwheaton@purdue.edu>
Wed, 3 Jun 2009 23:55:26 +0000 (19:55 -0400)
uzbl.c

diff --git a/uzbl.c b/uzbl.c
index 3e23cde..29b59ae 100644 (file)
--- a/uzbl.c
+++ b/uzbl.c
@@ -1680,6 +1680,12 @@ init_fifo(gchar *dir) { /* return dir or, on error, free dir and return NULL */
     GError *error = NULL;
     gchar *path = build_stream_name(FIFO, dir);
 
+    // This extra check is an alternative to recursively calling init_fifo() or using goto 
+    if (file_exists(path)) {
+        if (unlink(path))
+            g_warning ("init_fifo: can't delete %s: %s", path, strerror(errno));
+    }
+
     if (!file_exists(path)) {
         if (mkfifo (path, 0666) == 0) {
             // we don't really need to write to the file, but if we open the file as 'r' we will block here, waiting for a writer to open the file.