aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/main.c b/main.c
index 620cd6c1..f6597b84 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.192 2014/09/03 23:21:47 schwarze Exp $ */
+/* $Id: main.c,v 1.193 2014/10/18 15:57:34 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011, 2012, 2014 Ingo Schwarze <schwarze@openbsd.org>
@@ -581,14 +581,15 @@ passthrough(const char *file, int fd)
for (off = 0; off < nr; off += nw)
if ((nw = write(STDOUT_FILENO, buf + off,
(size_t)(nr - off))) == -1 || nw == 0) {
+ close(fd);
syscall = "write";
goto fail;
}
- if (nr == 0) {
- close(fd);
+ close(fd);
+
+ if (nr == 0)
return(MANDOCLEVEL_OK);
- }
syscall = "read";
fail: