examples: ipcpipeline: get rid of yet another use of SOCK_NONBLOCK
authorGeorge Kiagiadakis <george.kiagiadakis@collabora.com>
Mon, 4 Sep 2017 07:39:58 +0000 (10:39 +0300)
committerGeorge Kiagiadakis <george.kiagiadakis@collabora.com>
Mon, 4 Sep 2017 07:40:40 +0000 (10:40 +0300)
https://bugzilla.gnome.org/show_bug.cgi?id=786763

tests/examples/ipcpipeline/ipc-play.c

index 805bbcc..8c817a2 100644 (file)
@@ -969,10 +969,16 @@ main (gint argc, gchar ** argv)
     return 1;
   }
 
-  if (socketpair (AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, 0, pipes)) {
+  if (socketpair (AF_UNIX, SOCK_STREAM, 0, pipes)) {
     fprintf (stderr, "Error creating pipes: %s\n", strerror (errno));
     return 2;
   }
+  if (fcntl (pipes[0], F_SETFL, O_NONBLOCK) < 0 ||
+      fcntl (pipes[1], F_SETFL, O_NONBLOCK) < 0) {
+    fprintf (stderr, "Error setting O_NONBLOCK on pipes: %s\n",
+        strerror (errno));
+    return 2;
+  }
 
   pid = fork ();
   if (pid < 0) {