diff options
author | Rob Landley <rob@landley.net> | 2012-06-09 19:49:37 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2012-06-09 19:49:37 -0500 |
commit | 98356226c81109227faa89b721674e5fabf04b42 (patch) | |
tree | 4996ee3ad04c8bca534f23793244cbb86707d81c | |
parent | 23a66c86a54852ddc9c3d355f542109679a299f5 (diff) | |
download | toybox-98356226c81109227faa89b721674e5fabf04b42.tar.gz |
Feeding -1 to xdup() isn't an error.
-rw-r--r-- | lib/lib.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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; } |