summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@cvs.openbsd.org>2008-08-11 17:15:57 +0000
committerTobias Stoeckmann <tobias@cvs.openbsd.org>2008-08-11 17:15:57 +0000
commit171bacba8597637933eae4f43391a09c1aa8c53c (patch)
treea6654d73f1d51e668e97d1ca3c55cb2f305354ab /usr.sbin
parentb461b3dc7df254079c1b96b34955feab5d1be33b (diff)
Use only safe functions in signal handlers.
ok millert, otto
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/httpd/src/support/htdigest.c8
-rw-r--r--usr.sbin/httpd/src/support/htpasswd.c7
2 files changed, 9 insertions, 6 deletions
diff --git a/usr.sbin/httpd/src/support/htdigest.c b/usr.sbin/httpd/src/support/htdigest.c
index 05ff07f6a2e..849cd013519 100644
--- a/usr.sbin/httpd/src/support/htdigest.c
+++ b/usr.sbin/httpd/src/support/htdigest.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: htdigest.c,v 1.11 2008/05/23 12:12:01 mbalmer Exp $ */
+/* $OpenBSD: htdigest.c,v 1.12 2008/08/11 17:15:56 tobias Exp $ */
/* ====================================================================
* The Apache Software License, Version 1.1
@@ -81,6 +81,8 @@
#define MAX_STRING_LEN 256
+#define INTR_MSG "\nInterrupted.\n"
+
static char tn[MAX_STRING_LEN];
static void
@@ -179,10 +181,10 @@ usage(void)
static void
interrupted(void)
{
- fprintf(stderr, "Interrupted.\n");
+ write(STDERR_FILENO, INTR_MSG, sizeof(INTR_MSG) - 1);
if (tn[0] != '\0')
unlink(tn);
- exit(1);
+ _exit(1);
}
diff --git a/usr.sbin/httpd/src/support/htpasswd.c b/usr.sbin/httpd/src/support/htpasswd.c
index bde8594c62a..6c71c08a9bc 100644
--- a/usr.sbin/httpd/src/support/htpasswd.c
+++ b/usr.sbin/httpd/src/support/htpasswd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: htpasswd.c,v 1.17 2008/05/23 12:12:01 mbalmer Exp $ */
+/* $OpenBSD: htpasswd.c,v 1.18 2008/08/11 17:15:56 tobias Exp $ */
/* ====================================================================
* The Apache Software License, Version 1.1
@@ -100,6 +100,7 @@
#define ALG_APSHA 3
#define ALG_APBLF 4
+#define INTR_MSG "\nInterrupted.\n"
#define ERR_FILEPERM 1
#define ERR_SYNTAX 2
@@ -247,11 +248,11 @@ usage(void)
static void
interrupted(void)
{
- fprintf(stderr, "Interrupted.\n");
+ write(STDERR_FILENO, INTR_MSG, sizeof(INTR_MSG) - 1);
if (tempfilename[0] != '\0')
unlink(tempfilename);
- exit(ERR_INTERRUPTED);
+ _exit(ERR_INTERRUPTED);
}
/*