On Sat, Mar 05, 2016 at 07:04:13PM +0000, Anchit Jain wrote: [...] > + if (syscall(__NR_chmod, fname, 0600) != 0){ > + > + if (errno == ENOSYS){ > + printf("chmod(\"%s\", 0600) = -1 ENOSYS (%m)\n", fname); > + > + puts("+++ exited with 0 +++"); > + return 0; > + } > + > + perror_msg_and_fail("chmod"); > + } > + > + printf("chmod(\"%s\", 0600) = 0\n", fname); > + > + if (unlink(fname) == -1) > + perror_msg_and_fail("unlink"); > + > + if (syscall(__NR_chmod, fname, 0600) != -1) > + perror_msg_and_fail("chmod"); > + printf("chmod(\"%s\", 0600) = -1 ENOENT (%m)\n", fname); > + > + puts("+++ exited with 0 +++"); > + return 0;
This implementation might leak the temporary file. Also, please try to avoid unnecessary code duplication. -- ldv
pgppJY50O6ZeM.pgp
Description: PGP signature
------------------------------------------------------------------------------
_______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel