From 98356226c81109227faa89b721674e5fabf04b42 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 9 Jun 2012 19:49:37 -0500 Subject: Feeding -1 to xdup() isn't an error. --- lib/lib.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib') 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; } -- cgit v1.2.3