summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-11-19 20:27:15 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-11-19 20:27:15 +0000
commitd71af8664656628d5d27a8ac59f6a1b1b570387c (patch)
tree017ead60ffd1778430cf29258f175f37d3f7aa0a
parent4348c1eeecc4225e4a2b68d5acceba8696f95715 (diff)
only slight fixes needed in signal handlers
-rw-r--r--usr.sbin/lpr/lpd/lpd.c12
-rw-r--r--usr.sbin/lpr/lpd/printjob.c4
-rw-r--r--usr.sbin/lpr/lpd/recvjob.c8
3 files changed, 15 insertions, 9 deletions
diff --git a/usr.sbin/lpr/lpd/lpd.c b/usr.sbin/lpr/lpd/lpd.c
index 7d1833e083c..37e410e1682 100644
--- a/usr.sbin/lpr/lpd/lpd.c
+++ b/usr.sbin/lpr/lpd/lpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lpd.c,v 1.21 2001/09/05 00:22:49 deraadt Exp $ */
+/* $OpenBSD: lpd.c,v 1.22 2001/11/19 20:27:13 deraadt Exp $ */
/* $NetBSD: lpd.c,v 1.7 1996/04/24 14:54:06 mrg Exp $ */
/*
@@ -45,7 +45,7 @@ static const char copyright[] =
#if 0
static const char sccsid[] = "@(#)lpd.c 8.7 (Berkeley) 5/10/95";
#else
-static const char rcsid[] = "$OpenBSD: lpd.c,v 1.21 2001/09/05 00:22:49 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: lpd.c,v 1.22 2001/11/19 20:27:13 deraadt Exp $";
#endif
#endif /* not lint */
@@ -317,8 +317,8 @@ static void
reapchild(signo)
int signo;
{
- int status;
int save_errno = errno;
+ int status;
while (waitpid((pid_t)-1, &status, WNOHANG) > 0)
;
@@ -329,10 +329,12 @@ static void
mcleanup(signo)
int signo;
{
+ struct syslog_data sdata = SYSLOG_DATA_INIT;
+
if (lflag)
- syslog(LOG_INFO, "exiting");
+ syslog_r(LOG_INFO, &sdata, "exiting");
unlink(_PATH_SOCKETNAME);
- exit(0);
+ _exit(0);
}
/*
diff --git a/usr.sbin/lpr/lpd/printjob.c b/usr.sbin/lpr/lpd/printjob.c
index 2fc24865534..f6dfb3dc4be 100644
--- a/usr.sbin/lpr/lpd/printjob.c
+++ b/usr.sbin/lpr/lpd/printjob.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: printjob.c,v 1.27 2001/10/29 18:13:51 deraadt Exp $ */
+/* $OpenBSD: printjob.c,v 1.28 2001/11/19 20:27:13 deraadt Exp $ */
/* $NetBSD: printjob.c,v 1.9.4.3 1996/07/12 22:31:39 jtc Exp $ */
/*
@@ -1174,7 +1174,7 @@ abortpr(signo)
kill(ofilter, SIGCONT);
while (wait(NULL) > 0)
;
- exit(0);
+ _exit(0);
}
static void
diff --git a/usr.sbin/lpr/lpd/recvjob.c b/usr.sbin/lpr/lpd/recvjob.c
index 5c5f093c23c..3acadebfc7d 100644
--- a/usr.sbin/lpr/lpd/recvjob.c
+++ b/usr.sbin/lpr/lpd/recvjob.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: recvjob.c,v 1.15 2001/08/30 17:38:13 millert Exp $ */
+/* $OpenBSD: recvjob.c,v 1.16 2001/11/19 20:27:14 deraadt Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -44,7 +44,7 @@ static const char copyright[] =
#if 0
static const char sccsid[] = "@(#)recvjob.c 8.2 (Berkeley) 4/27/95";
#else
-static const char rcsid[] = "$OpenBSD: recvjob.c,v 1.15 2001/08/30 17:38:13 millert Exp $";
+static const char rcsid[] = "$OpenBSD: recvjob.c,v 1.16 2001/11/19 20:27:14 deraadt Exp $";
#endif
#endif /* not lint */
@@ -62,6 +62,7 @@ static const char rcsid[] = "$OpenBSD: recvjob.c,v 1.15 2001/08/30 17:38:13 mill
#include <dirent.h>
#include <syslog.h>
#include <stdio.h>
+#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "lp.h"
@@ -328,6 +329,8 @@ static void
rcleanup(signo)
int signo;
{
+ int save_errno = errno;
+
if (tfname[0] && strchr(tfname, '/') == NULL)
(void) unlink(tfname);
if (dfname[0] && strchr(dfname, '/') == NULL) {
@@ -339,6 +342,7 @@ rcleanup(signo)
} while (dfname[0]-- != 'd');
}
dfname[0] = '\0';
+ errno = save_errno;
}
#ifdef __STDC__