Skip to content

Commit

Permalink
dup2 fds can be bad.
Browse files Browse the repository at this point in the history
Coverity CID 104812.
  • Loading branch information
jhi committed Jun 27, 2015
1 parent 05732f9 commit 6e7b1a2
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions ext/POSIX/POSIX.xs
Expand Up @@ -3193,14 +3193,20 @@ dup2(fd1, fd2)
int fd1
int fd2
CODE:
if (fd1 >= 0 && fd2 >= 0) {
#ifdef WIN32
/* RT #98912 - More Microsoft muppetry - failing to actually implemented
the well known documented POSIX behaviour for a POSIX API.
http://msdn.microsoft.com/en-us/library/8syseb29.aspx */
RETVAL = dup2(fd1, fd2) == -1 ? -1 : fd2;
/* RT #98912 - More Microsoft muppetry - failing to
actually implemented the well known documented POSIX
behaviour for a POSIX API.
http://msdn.microsoft.com/en-us/library/8syseb29.aspx */
RETVAL = dup2(fd1, fd2) == -1 ? -1 : fd2;
#else
RETVAL = dup2(fd1, fd2);
RETVAL = dup2(fd1, fd2);
#endif
} else {
SETERRNO(EBADF,RMS_IFI);
RETVAL = -1;
}
OUTPUT:
RETVAL

Expand Down

0 comments on commit 6e7b1a2

Please sign in to comment.