Back to index

glibc  2.9
Functions
dup2.c File Reference
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <stub-tag.h>

Go to the source code of this file.

Functions

int __dup2 (int fd, int fd2)

Function Documentation

int __dup2 ( int  fd,
int  fd2 
)

Definition at line 27 of file dup2.c.

{
  if (fd < 0 || fd2 < 0)
    {
      __set_errno (EBADF);
      return -1;
    }

  if (fd == fd2)
    /* No way to check that they are valid.  */
    return fd2;

  __set_errno (ENOSYS);
  return -1;
}