dup2 (fd, -2) returned -2 instead of the proper -1.
* lib/dup2.c (rpl_dup2): Sanitize return value on mingw.
Reported by Simon Josefsson.
Signed-off-by: Eric Blake <ebb9@byu.net>
+2010-01-08 Eric Blake <ebb9@byu.net>
+
+ dup2: work around mingw bug
+ * lib/dup2.c (rpl_dup2): Sanitize return value on mingw.
+ Reported by Simon Josefsson.
+
2010-01-07 John W. Eaton <jwe@octave.org> (tiny change)
glob: Fix C++ compilation.
}
return fd;
}
+ /* Some mingw versions also return the wrong value if desired_fd is
+ negative but not -1. */
+ if (desired_fd < 0)
+ {
+ errno = EBADF;
+ return -1;
+ }
# endif
result = dup2 (fd, desired_fd);
# ifdef __linux__