diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2017-05-06 23:36:32 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2017-05-06 23:36:32 -0400 |
commit | c8c33b8c44751444729eda6a9fb7d4715928ea43 (patch) | |
tree | d2247b38683af70744f49f9fbe14cf707ea712c9 /main.c | |
parent | 72685e26e6cf5f19c840d8efaf54176ff12f7eca (diff) | |
download | bfs-c8c33b8c44751444729eda6a9fb7d4715928ea43.tar.xz |
main: Fix error checking of redirect()
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -23,8 +23,10 @@ static int ensure_fd_open(int fd, int flags) { if (isopen(fd)) { return 0; + } else if (redirect(fd, "/dev/null", flags) >= 0) { + return 0; } else { - return redirect(fd, "/dev/null", flags); + return -1; } } |