fix open return check
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>
Sun, 22 Jun 2008 00:33:08 +0000 (00:33 +0000)
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>
Sun, 22 Jun 2008 00:33:08 +0000 (00:33 +0000)
Originally committed as revision 13858 to svn://svn.ffmpeg.org/ffmpeg/trunk

ffserver.c

index 234820d..b094217 100644 (file)
@@ -392,12 +392,12 @@ static void start_children(FFStream *feed)
 
                 if (!ffserver_debug) {
                     i = open("/dev/null", O_RDWR);
-                    if (i)
+                    if (i != -1) {
                         dup2(i, 0);
-                    dup2(i, 1);
-                    dup2(i, 2);
-                    if (i)
+                        dup2(i, 1);
+                        dup2(i, 2);
                         close(i);
+                    }
                 }
 
                 av_strlcpy(pathname, my_program_name, sizeof(pathname));