11 cb (const char *fname
, const struct stat
*st
, int flag
)
13 printf ("%s %d\n", fname
, flag
);
21 char tmp
[] = "/tmp/ftwXXXXXX";
22 char tmp2
[] = "/tmp/ftwXXXXXX/ftwXXXXXX";
30 puts ("this test needs to be run by ordinary user");
34 dname
= mkdtemp (tmp
);
37 printf ("mkdtemp: %m\n");
41 memcpy (tmp2
, tmp
, strlen (tmp
));
42 dname2
= mkdtemp (tmp2
);
45 printf ("mkdtemp: %m\n");
50 if (chmod (dname
, S_IWUSR
|S_IWGRP
|S_IWOTH
) != 0)
52 printf ("chmod: %m\n");
57 r
= ftw (dname2
, cb
, 10);
61 printf (", errno = %d", errno
);
64 chmod (dname
, S_IRWXU
|S_IRWXG
|S_IRWXO
);
68 return (r
!= -1 && e
== EACCES
) || cb_called
;