summaryrefslogtreecommitdiffstats
path: root/277/regr/spec_files/fcntl.c
diff options
context:
space:
mode:
Diffstat (limited to '277/regr/spec_files/fcntl.c')
-rw-r--r--277/regr/spec_files/fcntl.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/277/regr/spec_files/fcntl.c b/277/regr/spec_files/fcntl.c
new file mode 100644
index 0000000..6aff3d4
--- /dev/null
+++ b/277/regr/spec_files/fcntl.c
@@ -0,0 +1,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;
+}
+