summaryrefslogtreecommitdiffstats
path: root/tests/bugs/nfs/bug-1210338.c
blob: 7a17b9d68ce4fa03664db1dbb6647937942b7f18 (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
25
26
27
28
29
30
31
32
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <fcntl.h>
#include <sys/stat.h>


int
main (int argc, char *argv[])
{
        int   ret  = -1;
        int   fd   = -1;

        fd = open (argv[1], O_CREAT|O_EXCL, 0644);

        if (fd == -1) {
                fprintf (stderr, "creation of the file %s failed (%s)\n", argv[1],
                         strerror (errno));
                goto out;
        }

        ret = 0;

out:
        if (fd > 0)
                close (fd);

        return ret;
}