summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/pax/pax.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/bin/pax/pax.c b/bin/pax/pax.c
index ab6dbc6955d..6017ba3b962 100644
--- a/bin/pax/pax.c
+++ b/bin/pax/pax.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pax.c,v 1.31 2010/12/02 04:08:27 tedu Exp $ */
+/* $OpenBSD: pax.c,v 1.32 2011/05/26 14:42:06 deraadt Exp $ */
/* $NetBSD: pax.c,v 1.5 1996/03/26 23:54:20 mrg Exp $ */
/*-
@@ -294,7 +294,7 @@ main(int argc, char **argv)
void
sig_cleanup(int which_sig)
{
- /* XXX signal races */
+ char errbuf[80];
/*
* restore modes and times for any dirs we may have created
@@ -302,16 +302,21 @@ sig_cleanup(int which_sig)
* will clearly see the message on a line by itself.
*/
vflag = vfpart = 1;
+
+ /* paxwarn() uses stdio; fake it as well as we can */
if (which_sig == SIGXCPU)
- paxwarn(0, "Cpu time limit reached, cleaning up.");
+ strlcpy(errbuf, "Cpu time limit reached, cleaning up.",
+ sizeof errbuf);
else
- paxwarn(0, "Signal caught, cleaning up.");
+ strlcpy(errbuf, "Signal caught, cleaning up.",
+ sizeof errbuf);
+ (void) write(STDERR_FILENO, errbuf, strlen(errbuf));
- ar_close();
- proc_dir();
+ ar_close(); /* XXX signal race */
+ proc_dir(); /* XXX signal race */
if (tflag)
- atdir_end();
- exit(1);
+ atdir_end(); /* XXX signal race */
+ _exit(1);
}
/*