this repo has no description
1#include <stdio.h>
2#include <stdlib.h>
3#include <fcntl.h>
4#include <sys/types.h>
5#include <sys/stat.h>
6#include <sys/param.h>
7#include <string.h>
8#include <assert.h>
9
10void test_getpath();
11
12int main()
13{
14 test_getpath();
15 return 0;
16}
17
18void test_getpath()
19{
20 char path[255] = "/tmp/fcntl.XXXXXX";
21 char fpath[MAXPATHLEN];
22 mkstemp(path);
23
24 int fd = open(path, O_WRONLY|O_CREAT|O_TRUNC, 0666);
25 fcntl(fd, F_GETPATH, fpath);
26
27 close(fd);
28
29 assert(strcmp(realpath(path, 0), realpath(fpath, 0)) == 0);
30 remove(path);
31}
32