diff options
Diffstat (limited to 'lib/lib.c')
-rw-r--r-- | lib/lib.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -210,8 +210,10 @@ void xclose(int fd) int xdup(int fd) { - fd = dup(fd); - if (fd == -1) perror_exit("xdup"); + if (fd != -1) { + fd = dup(fd); + if (fd == -1) perror_exit("xdup"); + } return fd; } |