[vlc-commits] netconf: Don't ignore posix_spawn_* errors

Hugo Beauzée-Luyssen git at videolan.org
Mon Oct 30 17:11:40 CET 2017


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Tue Oct 24 16:43:55 2017 +0200| [11cd9c27beb5614c5923c78429c37b8db1237d9a] | committer: Hugo Beauzée-Luyssen

netconf: Don't ignore posix_spawn_* errors

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=11cd9c27beb5614c5923c78429c37b8db1237d9a
---

 src/posix/netconf.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/posix/netconf.c b/src/posix/netconf.c
index 1ce6526711..e2db67b386 100644
--- a/src/posix/netconf.c
+++ b/src/posix/netconf.c
@@ -55,10 +55,15 @@ char *vlc_getProxyUrl(const char *url)
     if (vlc_pipe(fd))
         return NULL;
 
-    posix_spawn_file_actions_init(&actions);
-    posix_spawn_file_actions_addopen(&actions, STDIN_FILENO, "/dev/null",
-                                     O_RDONLY, 0644);
-    posix_spawn_file_actions_adddup2(&actions, fd[1], STDOUT_FILENO);
+    if (posix_spawn_file_actions_init(&actions))
+        return NULL;
+    if (posix_spawn_file_actions_addopen(&actions, STDIN_FILENO, "/dev/null",
+                                         O_RDONLY, 0644) ||
+        posix_spawn_file_actions_adddup2(&actions, fd[1], STDOUT_FILENO))
+    {
+        posix_spawn_file_actions_destroy(&actions);
+        return NULL;
+    }
 
     posix_spawnattr_init(&attr);
     {



More information about the vlc-commits mailing list