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. --- toys/posix/split.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'toys/posix') diff --git a/toys/posix/split.c b/toys/posix/split.c index 0da8da6a..daf6422e 100644 --- a/toys/posix/split.c +++ b/toys/posix/split.c @@ -65,7 +65,7 @@ static void do_split(int infd, char *in) if (j) error_exit("bad suffix"); bytesleft = TT.b; linesleft = TT.l; - if (outfd != -1) close(outfd); + xclose(outfd); outfd = xcreate(TT.outfile, O_RDWR|O_CREAT|O_TRUNC, st.st_mode & 0777); } @@ -86,7 +86,7 @@ static void do_split(int infd, char *in) } if (CFG_TOYBOX_FREE) { - if (outfd != -1) close(outfd); + xclose(outfd); if (infd) close(infd); free(TT.outfile); } -- cgit v1.2.3