Ticket #19054: foo.c

File foo.c, 605 bytes (added by bhaible, 2 weeks ago)

test case foo.c

Line 
1#include <errno.h>
2#include <sys/stat.h>
3#include <stdio.h>
4#include <string.h>
5#include <assert.h>
6
7int
8main ()
9{
10 {
11 errno = 0;
12 struct timespec new_times[2] =
13 {
14 { .tv_sec = 1724544000, .tv_nsec = 0 },
15 { .tv_sec = 1724544005, .tv_nsec = 0 }
16 };
17 int ret = utimensat (-1, "foo", new_times, 0);
18
19 if (ret >= 0)
20 printf ("ret = %d\n", ret);
21 else if (errno == EBADF)
22 printf ("ret = %d, errno == EBADF\n", ret);
23 else
24 printf ("ret = %d, errno == %s\n", ret, strerror (errno));
25
26 assert (ret < 0 && errno == EBADF);
27 }
28
29 printf ("OK\n");
30}