changeset 592:be4b2d3796eb

Feeding -1 to xdup() isn't an error.
author Rob Landley <rob@landley.net>
date Sat, 09 Jun 2012 19:49:37 -0500
parents 7c4ca3f0536b
children fb582378a36a
files lib/lib.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lib/lib.c	Sat Jun 09 19:06:49 2012 -0500
+++ b/lib/lib.c	Sat Jun 09 19:49:37 2012 -0500
@@ -210,8 +210,10 @@
 
 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;
 }