New dup.c - it now contains dup() and dup2() which makes dup2.c legacy.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7964 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
734893f6d2
commit
143691ef36
@ -1,22 +1,35 @@
|
||||
/*
|
||||
** Copyright 2001, Manuel J. Petit. All rights reserved.
|
||||
** Distributed under the terms of the NewOS License.
|
||||
** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
|
||||
#include <unistd.h>
|
||||
#include <syscalls.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
int
|
||||
dup(int fd)
|
||||
{
|
||||
int retval;
|
||||
|
||||
retval= sys_dup(fd);
|
||||
|
||||
if(retval< 0) {
|
||||
// set errno
|
||||
int status = _kern_dup(fd);
|
||||
if (status < 0) {
|
||||
errno = status;
|
||||
status = -1;
|
||||
}
|
||||
|
||||
return retval;
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
dup2(int oldFD, int newFD)
|
||||
{
|
||||
int status = _kern_dup2(oldFD, newFD);
|
||||
if (status < 0) {
|
||||
errno = status;
|
||||
status = -1;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
** Copyright 2001, Manuel J. Petit. All rights reserved.
|
||||
** Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <syscalls.h>
|
||||
|
||||
|
||||
int
|
||||
dup2(int ofd, int nfd)
|
||||
{
|
||||
int retval;
|
||||
|
||||
retval= sys_dup2(ofd, nfd);
|
||||
|
||||
if(retval< 0) {
|
||||
// set errno
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
Loading…
Reference in New Issue
Block a user