projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tweak for maintainability.
[pspp]
/
tests
/
test-pipe.c
diff --git
a/tests/test-pipe.c
b/tests/test-pipe.c
index e28fae70e56b0ec862f598d11325a703c76ce20f..16c72f6034a8ede26df8df4647aa7f101c69f2ce 100644
(file)
--- a/
tests/test-pipe.c
+++ b/
tests/test-pipe.c
@@
-38,6
+38,7
@@
(outside the range of interesting fd's during the test) set up to
duplicate the original stderr. */
(outside the range of interesting fd's during the test) set up to
duplicate the original stderr. */
+#define BACKUP_STDERR_FILENO 10
static FILE *myerr;
#define ASSERT(expr) \
static FILE *myerr;
#define ASSERT(expr) \
@@
-226,15
+227,16
@@
main (int argc, char *argv[])
}
if (strcmp (argv[1], "child") == 0)
{
}
if (strcmp (argv[1], "child") == 0)
{
- /* fd 2 might be closed, but fd 10 is the original stderr. */
- myerr = fdopen (10, "w");
+ /* fd 2 might be closed, but fd BACKUP_STDERR_FILENO is the original
+ stderr. */
+ myerr = fdopen (BACKUP_STDERR_FILENO, "w");
if (!myerr)
return 2;
return child_main (argc, argv);
}
/* We might close fd 2 later, so save it in fd 10. */
if (!myerr)
return 2;
return child_main (argc, argv);
}
/* We might close fd 2 later, so save it in fd 10. */
- if (dup2 (STDERR_FILENO,
10) != 10
- || (myerr = fdopen (
10
, "w")) == NULL)
+ if (dup2 (STDERR_FILENO,
BACKUP_STDERR_FILENO) != BACKUP_STDERR_FILENO
+ || (myerr = fdopen (
BACKUP_STDERR_FILENO
, "w")) == NULL)
return 2;
return parent_main (argc, argv);
}
return 2;
return parent_main (argc, argv);
}