s3/g_lock: add g_lock_locks() and g_lock_locks_read() varients
[samba4-gss.git] / tests / readlink.c
bloba09eba4af2bebd2b1d897cca4c034d4358ceb8c7
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 */
6 #if defined(HAVE_UNISTD_H)
7 #include <unistd.h>
8 #endif
10 #include <sys/types.h>
11 #include <sys/stat.h>
12 #include <fcntl.h>
14 #define DATA "readlink.test"
15 #define FNAME "rdlnk.file"
17 int main(void)
19 char buf[7];
20 int ret;
21 ssize_t rl_ret;
23 unlink(FNAME);
24 ret = symlink(DATA, FNAME);
25 if (ret == -1) {
26 exit(0);
29 rl_ret = readlink(FNAME, buf, sizeof(buf));
30 if (rl_ret == -1) {
31 unlink(FNAME);
32 exit(0);
34 unlink(FNAME);
35 exit(1);