Back to index

python3.2  3.2.2
Defines | Functions
dup2.c File Reference
#include <fcntl.h>
#include <unistd.h>

Go to the source code of this file.


#define BADEXIT   -1


int dup2 (int fd1, int fd2)

Define Documentation

#define BADEXIT   -1

Definition at line 17 of file dup2.c.

Function Documentation

int dup2 ( int  fd1,
int  fd2 

Definition at line 20 of file dup2.c.

       if (fd1 != fd2) {
              if (fcntl(fd1, F_GETFL) < 0)
                     return BADEXIT;
              if (fcntl(fd2, F_GETFL) >= 0)
              if (fcntl(fd1, F_DUPFD, fd2) < 0)
                     return BADEXIT;
       return fd2;

Here is the caller graph for this function: