05.03.2016, 22:38, "Dmitry V. Levin" <l...@altlinux.org>: > On Sat, Mar 05, 2016 at 11:11:26AM +0530, Anchit Jain wrote: >> 05.03.2016, 03:12, "Dmitry V. Levin" <l...@altlinux.org>: >> > On Fri, Mar 04, 2016 at 08:45:48PM +0000, Anchit Jain wrote: >> > [...] >> >> +#include "tests.h" >> >> +#include <assert.h> >> > >> > As you no longer use assert, no need to include <assert.h>. >> > >> >> +#include <fcntl.h> >> >> +#include <stdio.h> >> >> +#include <unistd.h> >> >> +#include <errno.h> >> >> +#include <sys/syscall.h> >> >> + >> >> +#if defined __NR_chmod >> > >> > The only two headers that have to be included before __NR_chmod test >> > are "tests.h" and <sys/syscall.h>. >> > >> > In case you are in pedantic mood, all the rest could be included >> > after __NR_chmod test, like in tests/alarm.c and many similar tests. >> > >> >> + >> >> +int >> >> +main(void) >> >> +{ >> >> + static const char fname[] = "chmod_test_file"; >> >> + int fd = open(fname, O_CREAT|O_RDONLY, 0400); >> >> + >> >> + if (fd == -1) >> >> + perror_msg_and_fail("open"); >> >> + >> >> + if (syscall(__NR_chmod, fname, 0600) != 0) >> >> + { >> > >> > The opening brace should be placed on "if" line. >> > >> >> + if (errno == ENOSYS) >> >> + perror_msg_and_fail("chmod ENOSYS"); >> > >> > If chmod has failed with ENOSYS, it might be a normal condition >> > on some architectures, so it shouldn't be treated as a test error. >> > Just print it using >> > >> > printf("chmod(\"%s\", 0600) = -1 ENOSYS (%m)\n", fname); >> >> But the test should not continue after this, > > Why not? It just shouldn't test for ENOENT decoding.
So I should maintain a flag variable for ENOSYS and only when it is unset than only have test for ENOENT decoding? > > -- > ldv > , > > ------------------------------------------------------------------------------ > , > > _______________________________________________ > Strace-devel mailing list > Strace-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/strace-devel -- Sincerely, Anchit Jain mailingl...@anchitja.in ------------------------------------------------------------------------------ _______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel