summaryrefslogtreecommitdiffstats
path: root/277/regr/spec_files/fcntl.c
blob: 6aff3d462ef09991a81a03540208cf105d282831 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<errno.h>

int main(int argc, char *argv[])
{
  int fd;
  int dup_fd;
  fd = open (argv[1], O_RDONLY | O_CREAT,0755);
  if (fd == -1) {
    return errno;
  } else {
    dup_fd = fcntl(fd, F_DUPFD);
  }
  if ( dup_fd == -1) {
    return errno;
  } else
    return 0;
}