[pulseaudio-discuss] [PATCH 2/2] module-pipe: check return value of mkfifo()

Peter Meerwald pmeerw at pmeerw.net
Thu May 24 08:52:56 PDT 2012


From: Peter Meerwald <p.meerwald at bct-electronic.com>

---
 src/modules/module-pipe-sink.c   |    5 ++++-
 src/modules/module-pipe-source.c |    5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/modules/module-pipe-sink.c b/src/modules/module-pipe-sink.c
index fa0a080..ef18fad 100644
--- a/src/modules/module-pipe-sink.c
+++ b/src/modules/module-pipe-sink.c
@@ -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;
diff --git a/src/modules/module-pipe-source.c b/src/modules/module-pipe-source.c
index eb531d8..7a7dfb2 100644
--- a/src/modules/module-pipe-source.c
+++ b/src/modules/module-pipe-source.c
@@ -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;
-- 
1.7.5.4



More information about the pulseaudio-discuss mailing list