aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2012-06-09 19:49:37 -0500
committerRob Landley <rob@landley.net>2012-06-09 19:49:37 -0500
commit98356226c81109227faa89b721674e5fabf04b42 (patch)
tree4996ee3ad04c8bca534f23793244cbb86707d81c /lib
parent23a66c86a54852ddc9c3d355f542109679a299f5 (diff)
downloadtoybox-98356226c81109227faa89b721674e5fabf04b42.tar.gz
Feeding -1 to xdup() isn't an error.
Diffstat (limited to 'lib')
-rw-r--r--lib/lib.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/lib.c b/lib/lib.c
index 7af2af11..ec491063 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -210,8 +210,10 @@ void xclose(int fd)
int xdup(int fd)
{
- fd = dup(fd);
- if (fd == -1) perror_exit("xdup");
+ if (fd != -1) {
+ fd = dup(fd);
+ if (fd == -1) perror_exit("xdup");
+ }
return fd;
}