summaryrefslogtreecommitdiffstats
path: root/277/regr/spec_files/fcntl.c
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendrabhat@gluster.com>2009-12-01 22:02:59 -0800
committerVijay Bellur <vijay@gluster.com>2010-01-26 20:48:20 +0530
commitbdc172371ec2a9823f91b0cfb1f5ac8b7d92c5f0 (patch)
tree94eea8fc5f2b0dc55e96f812e383ae4a8785b372 /277/regr/spec_files/fcntl.c
parent864565ab9030a93b93c7c30a7adc60134816a2a1 (diff)
Regression testcase for bug 277
Signed-off-by: Vijay Bellur <vijay@gluster.com>
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;
+}
+