Hi! > diff --git a/testcases/kernel/syscalls/chroot/chroot03.c > b/testcases/kernel/syscalls/chroot/chroot03.c > index 9376892..69fead4 100644 > --- a/testcases/kernel/syscalls/chroot/chroot03.c > +++ b/testcases/kernel/syscalls/chroot/chroot03.c > @@ -151,7 +151,9 @@ static void setup(void) > * set up good_dir to test whether chroot() is setting ENOENT if the > * directory does not exist. > */ > - (void)sprintf(good_dir, "%s.%d", good_dir, getpid()); > + good_dir_dup = strdup(good_dir); > + (void)sprintf(good_dir, "%s.%d", good_dir_dup, getpid()); > + free(good_dir_dup);
Rather than that we can simply use "nonexistent" as the directory name. Because the test creates unique test temporary directory at the start and changes working directory to it. Then any local path points to a nonexistent directory. Also naming the variable good_dir is a bad idea. It should be named nonexistent_dir or so. > #if !defined(UCLINUX) > bad_addr = mmap(0, 1, PROT_NONE, > diff --git a/testcases/kernel/syscalls/creat/creat04.c > b/testcases/kernel/syscalls/creat/creat04.c > index 0268e77..44c249f 100644 > --- a/testcases/kernel/syscalls/creat/creat04.c > +++ b/testcases/kernel/syscalls/creat/creat04.c > @@ -192,10 +192,11 @@ void setup(void) > > /* make a temporary directory and cd to it */ > tst_tmpdir(); > - > - sprintf(good_dir, "%s.%d", good_dir, getpid()); > - sprintf(fname1, "%s/file1.%d", good_dir, getpid()); > - sprintf(fname, "%s/file.%d", good_dir, getpid()); > + good_dir_dup = strdup(good_dir); > + sprintf(good_dir, "%s.%d", good_dir_dup, getpid()); > + sprintf(fname1, "%s/file1.%d", good_dir_dup, getpid()); > + sprintf(fname, "%s/file.%d", good_dir_dup, getpid()); > + free(good_dir_dup); There is no need to append pid to the directory and file name, the test temporary directory create by tst_tmpdir() is unique allready. So rather than doing ugly workarounds like that, what about removing the sprintf() and usign static directory and file names? -- Cyril Hrubis chru...@suse.cz ------------------------------------------------------------------------------ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list