From: tobias Date: Mon, 11 Aug 2008 17:15:56 +0000 (+0000) Subject: Use only safe functions in signal handlers. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=03aec23ce6ce03082e48dfbf2eaac08b4a1ac4d1;p=openbsd Use only safe functions in signal handlers. ok millert, otto --- 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); } /*