tests: Add a test for the idmap_nss : use_upn setting
[scabrero/samba-autobuild/.git] / tests / readlink.c
1 /* test whether readlink returns a short buffer incorrectly.
2    We need to return 0 in case readlink is *broken* here - this is because our waf
3    CHECK_CODE function does only allow generating defines in case the test succeeds
4 */
5
6 #if defined(HAVE_UNISTD_H)
7 #include <unistd.h>
8 #endif
9
10 #include <sys/types.h>
11 #include <sys/stat.h>
12 #include <fcntl.h>
13
14 #define DATA "readlink.test"
15 #define FNAME "rdlnk.file"
16
17 int main(void)
18 {
19         char buf[7];
20         int ret;
21         ssize_t rl_ret;
22
23         unlink(FNAME);
24         ret = symlink(DATA, FNAME);
25         if (ret == -1) {
26                 exit(0);
27         }
28
29         rl_ret = readlink(FNAME, buf, sizeof(buf));
30         if (rl_ret == -1) {
31                 unlink(FNAME);
32                 exit(0);
33         }
34         unlink(FNAME);
35         exit(1);
36 }