On Thu, Mar 10, 2016 at 03:14:22PM +0530, Anchit Jain wrote: > +#if defined __NR_fchownat > + > +#include <fcntl.h> > +#include <stdio.h> > +#include <unistd.h> > +#include <errno.h> > + > +int > +main(void) > +{ > + static const char fname[] = "fchownat_test_file"; > + > + if (open(fname, O_CREAT|O_RDONLY, 0400) == -1) > + perror_msg_and_fail("open"); > + > + uid_t uid = getuid(); > + gid_t gid = getgid(); > + > + if (syscall(__NR_fchownat, AT_FDCWD, fname, uid, gid, 0) != 0) > + perror_msg_and_fail("fchownat");
Please explain why do you think a failed fchownat syscall should be treated as a test error. > + printf("fchownat(AT_FDCWD, \"%s\", %d, %d, 0) = 0\n", fname, uid, gid); > + > + if (unlink(fname) == -1) > + perror_msg_and_fail("unlink"); > + > + if (syscall(__NR_fchownat, AT_FDCWD, fname, uid, gid, 0) != -1) > + perror_msg_and_fail("fchownat"); I'd suggest also to use a non-zero flags argument, e.g. AT_SYMLINK_NOFOLLOW, in one of fchownat calls. I think a non-zero flags argument, e.g. AT_SYMLINK_NOFOLLOW, also worths testing. Please check that AT_FDCWD and AT_SYMLINK_NOFOLLOW are defined -- older libcs might not provide them. > + printf("fchownat(AT_FDCWD, \"%s\", %d, %d, 0) = -1 ENOENT (%m)\n", > fname, uid, gid); Please wrap long lines. -- ldv
pgpamGp9jDpZ4.pgp
Description: PGP signature
------------------------------------------------------------------------------ Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more. http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel