diff options
author | Dieter Plaetinck <dieter@plaetinck.be> | 2009-05-03 10:37:08 +0200 |
---|---|---|
committer | Dieter Plaetinck <dieter@plaetinck.be> | 2009-05-03 10:37:08 +0200 |
commit | d77bbddf2458c0b3ba8c9d4cc3c6214d63d706b8 (patch) | |
tree | 169c79558b9898110a0b7e843eb2a53b8b4722dc | |
parent | b9bf66f1051eea96a78d65a8c18079690f19a4d4 (diff) |
fix for blocking on open(fifo) waiting for a writer
-rw-r--r-- | uzbl.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -510,10 +510,11 @@ create_fifo() { printf ("Fifo: disabled. Error when creating %s: File exists\n", fifo_path); return; } - if (mkfifo (fifo_path, 0666) == -1) { //TODO: mkfifo blocks (waits for writer) + if (mkfifo (fifo_path, 0666) == -1) { printf ("Fifo: disabled. Error when creating %s: %s\n", fifo_path, strerror(errno)); } else { - chan = g_io_channel_new_file((gchar *) fifo_path, "r", &error); + // 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. + chan = g_io_channel_new_file((gchar *) fifo_path, "r+", &error); if (chan) { printf ("Fifo: created successfully as %s\n", fifo_path); g_io_add_watch(chan, G_IO_IN|G_IO_HUP, (GIOFunc) control_fifo, chan); |