summaryrefslogtreecommitdiffstats
path: root/tests/bugs/nfs/bug-1210338.c
blob: 77f56eb9d0b683f8453c3ec98c2622df2a27ad48 (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);

        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;
}