aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2021-02-08 03:08:26 -0600
committerRob Landley <rob@landley.net>2021-02-08 03:08:26 -0600
commita079039934311f64a48e1010a97492a22126042e (patch)
treedf156add0a45e445c57dd70354cd7e2f85ff697f /lib
parentbdb0e5fd6e031f9b3fae95d8180cf6bba32384c8 (diff)
downloadtoybox-a079039934311f64a48e1010a97492a22126042e.tar.gz
Have xclose() perform the fd != -1 test.
Diffstat (limited to 'lib')
-rw-r--r--lib/xwrap.c2
1 files changed, 1 insertions, 1 deletions
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)