From a079039934311f64a48e1010a97492a22126042e Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 8 Feb 2021 03:08:26 -0600 Subject: Have xclose() perform the fd != -1 test. --- lib/xwrap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/xwrap.c b/lib/xwrap.c index 22f00f2b..607f3c61 100644 --- a/lib/xwrap.c +++ b/lib/xwrap.c @@ -416,7 +416,7 @@ void xpipe(int *pp) void xclose(int fd) { - if (close(fd)) perror_exit("xclose"); + if (fd != -1 && close(fd)) perror_exit("xclose"); } int xdup(int fd) -- cgit v1.2.3