diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-10-05 20:11:13 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-10-05 20:30:58 +0200 |
| commit | 3a6e37c6443111a40dd0eb299fdfa2fddc197618 (patch) | |
| tree | a3703f03587c0b5105669e7832de1d73cd9de6b1 | |
| parent | 3bf47e1efec9ced0d48660aa99762cf06eb5e897 (diff) | |
| download | vis-3a6e37c6443111a40dd0eb299fdfa2fddc197618.tar.gz vis-3a6e37c6443111a40dd0eb299fdfa2fddc197618.tar.xz | |
vis: check return value of fcntl(2) call
| -rw-r--r-- | vis.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1312,9 +1312,9 @@ int vis_pipe(Vis *vis, Filerange *range, bool interactive, const char *argv[], close(pout[1]); close(perr[1]); - fcntl(pout[0], F_SETFL, O_NONBLOCK); - fcntl(perr[0], F_SETFL, O_NONBLOCK); - + if (fcntl(pout[0], F_SETFL, O_NONBLOCK) == -1 || + fcntl(perr[0], F_SETFL, O_NONBLOCK) == -1) + goto err; fd_set rfds, wfds; @@ -1393,6 +1393,7 @@ int vis_pipe(Vis *vis, Filerange *range, bool interactive, const char *argv[], } while (pin[1] != -1 || pout[0] != -1 || perr[0] != -1); +err: if (pin[1] != -1) close(pin[1]); if (pout[0] != -1) |
