diff options
author | cvs2svn <cvs2svn@FreeBSD.org> | 2008-03-19 14:47:00 +0000 |
---|---|---|
committer | cvs2svn <cvs2svn@FreeBSD.org> | 2008-03-19 14:47:00 +0000 |
commit | 43e0cf0679692d491cfc84d79fabdf31f2f6c175 (patch) | |
tree | 83b653337b4911d9e94ce54584367e0f0abeb16e /gnu/usr.bin/cvs/lib/dup2.c | |
parent | 76fd2245b5dc6793b57cc7c3bf4fc6af7a352563 (diff) |
Notes
Diffstat (limited to 'gnu/usr.bin/cvs/lib/dup2.c')
-rw-r--r-- | gnu/usr.bin/cvs/lib/dup2.c | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/gnu/usr.bin/cvs/lib/dup2.c b/gnu/usr.bin/cvs/lib/dup2.c deleted file mode 100644 index 19743830ca6e..000000000000 --- a/gnu/usr.bin/cvs/lib/dup2.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - dup2 -- 7th Edition UNIX system call emulation for UNIX System V - - last edit: 11-Feb-1987 D A Gwyn -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <errno.h> -#include <fcntl.h> - -extern int close(), fcntl(); - -int -dup2( oldfd, newfd ) - int oldfd; /* already-open file descriptor */ - int newfd; /* desired duplicate descriptor */ -{ - register int ret; /* for fcntl() return value */ - register int save; /* for saving entry errno */ - - if ( oldfd == newfd ) - return oldfd; /* be careful not to close() */ - - save = errno; /* save entry errno */ - (void) close( newfd ); /* in case newfd is open */ - /* (may have just clobbered the original errno value) */ - - ret = fcntl( oldfd, F_DUPFD, newfd ); /* dupe it */ - - if ( ret >= 0 ) - errno = save; /* restore entry errno */ - else /* fcntl() returned error */ - if ( errno == EINVAL ) - errno = EBADF; /* we think of everything */ - - return ret; /* return file descriptor */ -} |