[PATCH] tests: add chmod.test

Dmitry V. Levin ldv at altlinux.org
Fri Mar 4 20:09:31 UTC 2016


On Sat, Mar 05, 2016 at 01:33:55AM +0530, Anchit Jain wrote:
> 05.03.2016, 01:17, "Dmitry V. Levin" <ldv at altlinux.org>:
> > On Fri, Mar 04, 2016 at 07:26:35PM +0000, Anchit Jain wrote:
[...]
> >>  + int create_file_desc = open("chmod_test_file", O_CREAT|O_RDONLY, 0400);
> >
> > Do you plan to use other descriptors besides this one?
> > If not, "create_file_desc" is too verbose.
> 
> Would file_desc work?

Even "fd" would be OK.

> >>  + perror_msg_and_fail("chmod -1");
> >
> > What does this "chmod -1" mean?
> 
> What should be the error message? Like chmod failed due to this error?

Since it's "open" that failed and not "chmod", just use "open".

> >>  + if(syscall(__NR_chmod, "chmod_test_file", 0600) != 0)
> >>  + perror_msg_and_fail("chmod -1");
> >
> > Let me repeat: chmod syscall can legitimately fail with ENOSYS.
> 
> How can I check that?

errno == ENOSYS?


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160304/4c32d778/attachment.bin>


More information about the Strace-devel mailing list