* tests/test-dup2.c (main): Tolerate leaked fds from environment.
Reported by Peter Breitenlohner <peb@mppmu.mpg.de>.
Signed-off-by: Eric Blake <ebb9@byu.net>
2009-08-13 Eric Blake <ebb9@byu.net>
+ test-dup2: fix bad assumption
+ * tests/test-dup2.c (main): Tolerate leaked fds from environment.
+ Reported by Peter Breitenlohner <peb@mppmu.mpg.de>.
+
test-version-etc: fix CRLF portability issue
* tests/test-version-etc.sh: Use tr, not sed, as not all sed
recognize \r.
char buffer[1];
int fd = open (file, O_CREAT | O_RDWR, 0600);
- ASSERT (0 <= fd);
+ /* Assume std descriptors were provided by invoker. */
+ ASSERT (STDERR_FILENO < fd);
ASSERT (is_open (fd));
+ /* Ignore any other fd's leaked into this process. */
+ close (fd + 1);
+ close (fd + 2);
ASSERT (!is_open (fd + 1));
ASSERT (!is_open (fd + 2));