pipe: check return value of mkfifo()
authorPeter Meerwald <p.meerwald@bct-electronic.com>
Thu, 24 May 2012 15:52:56 +0000 (17:52 +0200)
committerArun Raghavan <arun.raghavan@collabora.co.uk>
Tue, 29 May 2012 03:33:15 +0000 (09:03 +0530)
src/modules/module-pipe-sink.c
src/modules/module-pipe-source.c

index fa0a080bef95af49b85ab60de39e4e471519e17e..ef18fad6f0ea0f2bc750a2b8770225f288565bda 100644 (file)
@@ -255,7 +255,10 @@ int pa__init(pa_module *m) {
 
     u->filename = pa_runtime_path(pa_modargs_get_value(ma, "file", DEFAULT_FILE_NAME));
 
-    mkfifo(u->filename, 0666);
+    if (mkfifo(u->filename, 0666) < 0) {
+        pa_log("mkfifo('%s'): %s", u->filename, pa_cstrerror(errno));
+        goto fail;
+    }
     if ((u->fd = pa_open_cloexec(u->filename, O_RDWR, 0)) < 0) {
         pa_log("open('%s'): %s", u->filename, pa_cstrerror(errno));
         goto fail;
index eb531d8533b1cde7d961705d192d8217d1db6ae5..7a7dfb2728978bced8ea3b61f4849f79faaeac63 100644 (file)
@@ -240,7 +240,10 @@ int pa__init(pa_module *m) {
 
     u->filename = pa_runtime_path(pa_modargs_get_value(ma, "file", DEFAULT_FILE_NAME));
 
-    mkfifo(u->filename, 0666);
+    if (mkfifo(u->filename, 0666) < 0) {
+        pa_log("mkfifo('%s'): %s", u->filename, pa_cstrerror(errno));
+        goto fail;
+    }
     if ((u->fd = pa_open_cloexec(u->filename, O_RDWR, 0)) < 0) {
         pa_log("open('%s'): %s", u->filename, pa_cstrerror(errno));
         goto fail;