summaryrefslogtreecommitdiffstats
path: root/usr.sbin/lpr
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2014-07-20 01:38:40 +0000
committerguenther <guenther@openbsd.org>2014-07-20 01:38:40 +0000
commitffb4dd050d1e35f39b1d6c1c600db7c6443475c2 (patch)
tree0e41db8f3c733eb324a6a362a29149f077ad4c74 /usr.sbin/lpr
parentDelete unused variables found by -Wall (diff)
downloadwireguard-openbsd-ffb4dd050d1e35f39b1d6c1c600db7c6443475c2.tar.xz
wireguard-openbsd-ffb4dd050d1e35f39b1d6c1c600db7c6443475c2.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 'usr.sbin/lpr')
-rw-r--r--usr.sbin/lpr/common_source/startdaemon.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/lpr/common_source/startdaemon.c b/usr.sbin/lpr/common_source/startdaemon.c
index ca646693bb4..6274215387f 100644
--- a/usr.sbin/lpr/common_source/startdaemon.c
+++ b/usr.sbin/lpr/common_source/startdaemon.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: startdaemon.c,v 1.13 2009/10/27 23:59:51 deraadt Exp $ */
+/* $OpenBSD: startdaemon.c,v 1.14 2014/07/20 01:38:40 guenther Exp $ */
/* $NetBSD: startdaemon.c,v 1.10 1998/07/18 05:04:39 lukem Exp $ */
/*
@@ -67,6 +67,7 @@ startdaemon(char *printer)
siginterrupt(SIGINT, 1);
PRIV_START;
if (connect(s, (struct sockaddr *)&un, SUN_LEN(&un)) < 0) {
+ int saved_errno = errno;
if (errno == EINTR && gotintr) {
PRIV_END;
siginterrupt(SIGINT, 0);
@@ -75,7 +76,7 @@ startdaemon(char *printer)
}
PRIV_END;
siginterrupt(SIGINT, 0);
- warn("connect");
+ warnc(saved_errno, "connect");
(void)close(s);
return(0);
}