summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/main.c b/main.c
index bcb0c11..0b957d3 100644
--- a/main.c
+++ b/main.c
@@ -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;
}
}