diff options
author | Rob Landley <rob@landley.net> | 2021-02-08 03:08:26 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2021-02-08 03:08:26 -0600 |
commit | a079039934311f64a48e1010a97492a22126042e (patch) | |
tree | df156add0a45e445c57dd70354cd7e2f85ff697f /toys/posix | |
parent | bdb0e5fd6e031f9b3fae95d8180cf6bba32384c8 (diff) | |
download | toybox-a079039934311f64a48e1010a97492a22126042e.tar.gz |
Have xclose() perform the fd != -1 test.
Diffstat (limited to 'toys/posix')
-rw-r--r-- | toys/posix/split.c | 4 |
1 files changed, 2 insertions, 2 deletions
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); } |