fix special-case breakage in popen due to reversed argument order
authorRich Felker <dalias@aerifal.cx>
Sun, 1 Sep 2013 21:02:35 +0000 (17:02 -0400)
committerRich Felker <dalias@aerifal.cx>
Sun, 1 Sep 2013 21:02:35 +0000 (17:02 -0400)
src/stdio/popen.c

index 28ff23fd1614422bdbeb907529b08c7ec5c6b413..92cb57ee937b7ea3908de2c0de86ced5eefb3d8d 100644 (file)
@@ -39,7 +39,7 @@ FILE *popen(const char *cmd, const char *mode)
         * remove the close-on-exec flag in the child without also creating
         * a file descriptor leak race condition in the parent. */
        if (p[1-op] == 1-op) {
-               int tmp = fcntl(F_DUPFD_CLOEXEC, 1-op, 0);
+               int tmp = fcntl(1-op, F_DUPFD_CLOEXEC, 0);
                if (tmp < 0) {
                        e = errno;
                        goto fail;