1 /* Check that odd cases of readlink work.
2 #notarget: cris*-*-elf
3 #cc: additional_flags=-DX="@exedir@"
4 */
5 
6 #include <unistd.h>
7 #include <errno.h>
8 #include <stdio.h>
9 #include <stdlib.h>
10 
main(int argc,char * argv[])11 int main (int argc, char *argv[])
12 {
13   /* We assume that "sim/testsuite" isn't renamed to anything that
14      together with "<builddir>/" is shorter than 7 characters.  */
15   char buf[7];
16 
17   if (readlink("/proc/42/exe", buf, sizeof (buf)) != sizeof (buf)
18       || strncmp (buf, X, sizeof (buf)) != 0)
19     abort ();
20 
21   printf ("pass\n");
22   exit (0);
23 }
24