trylinkat.c (443B)
1 /* ISC license. */ 2 3 #undef _POSIX_C_SOURCE 4 #undef _XOPEN_SOURCE 5 6 #ifndef _GNU_SOURCE 7 #define _GNU_SOURCE 8 #endif 9 10 #ifndef _ATFILE_SOURCE 11 #define _ATFILE_SOURCE 12 #endif 13 14 #ifndef _INCOMPLETE_XOPEN_C063 15 #define _INCOMPLETE_XOPEN_C063 16 #endif 17 18 #ifndef __EXTENSIONS__ 19 #define __EXTENSIONS__ 20 #endif 21 22 #include <unistd.h> 23 #include <fcntl.h> 24 25 int main (void) 26 { 27 int r = linkat(AT_FDCWD, "/foo", AT_FDCWD, "foo", AT_SYMLINK_FOLLOW) ; 28 return (r < 0) ; 29 }