summaryrefslogtreecommitdiff
path: root/src/usr.bin
diff options
context:
space:
mode:
authorguenther <>2014-07-20 01:38:40 +0000
committerguenther <>2014-07-20 01:38:40 +0000
commitde21c6ec21e1a745fd5d9c4878218fb4d07f0737 (patch)
tree5e6c4eae816d1f4766599fa8e5f8fea5d7d1a35e /src/usr.bin
parent61b0982e8e00b9d378695b1873b5409afd7d7b96 (diff)
downloadopenbsd-de21c6ec21e1a745fd5d9c4878218fb4d07f0737.tar.gz
openbsd-de21c6ec21e1a745fd5d9c4878218fb4d07f0737.tar.bz2
openbsd-de21c6ec21e1a745fd5d9c4878218fb4d07f0737.zip
Make sure the correct errno is reported by warn* or err* and not
the errno of an intervening cleanup operation like close/unlink/etc. Diff from Doug Hogan (doug (at) acyclic.org)
Diffstat (limited to 'src/usr.bin')
-rw-r--r--src/usr.bin/nc/netcat.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/usr.bin/nc/netcat.c b/src/usr.bin/nc/netcat.c
index 76794df6c0..58454595b2 100644
--- a/src/usr.bin/nc/netcat.c
+++ b/src/usr.bin/nc/netcat.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: netcat.c,v 1.121 2014/06/10 16:35:42 tedu Exp $ */ 1/* $OpenBSD: netcat.c,v 1.122 2014/07/20 01:38:40 guenther Exp $ */
2/* 2/*
3 * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> 3 * Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
4 * 4 *
@@ -753,8 +753,9 @@ readwrite(int nfd)
753 sleep(iflag); 753 sleep(iflag);
754 754
755 if ((n = poll(pfd, 2 - dflag, timeout)) < 0) { 755 if ((n = poll(pfd, 2 - dflag, timeout)) < 0) {
756 int saved_errno = errno;
756 close(nfd); 757 close(nfd);
757 err(1, "Polling Error"); 758 errc(1, saved_errno, "Polling Error");
758 } 759 }
759 760
760 if (n == 0) 761 if (n == 0)