This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 1/2] Use libsupport for tst-spawn.c
* Adhemerval Zanella:
> /* Try to write to the file. This should not be allowed. */
> + xwrite (fd3, "boo!", 4);
> + TEST_COMPARE (errno, EBADF);
You need to write this as:
TEST_COMPARE (write (fd3, "boo!", 4), -1);
TEST_COMPARE (errno, EBADF);
xwrite will terminate the process.
> /* Now try to read the first file. First make sure it is not opened. */
> + TEST_COMPARE (xlseek (fd1, 0, SEEK_CUR), (off_t) -1);
> + TEST_COMPARE (errno, EBADF);
Same problem: Use lseek, not xlseek.
> + TEST_COMPARE (read (fd1, buf, sizeof buf), strlen (fd1string));
> + TEST_COMPARE_BLOB (fd1string, strlen (fd1string), buf, strlen (fd2string));
There's a typo here: strlen (fd2string) should be strlen (fd1string).
I also saw this:
/* Close the third file. It'll be opened by `spawn'. */
close (temp_fd3);
You could turn this into xclose for additional error checking.
Otherwise, this version is fine. Thanks.
Florian