diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2011-05-26 14:42:07 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2011-05-26 14:42:07 +0000 |
commit | 4b2d5edc1312f85085dbdd9d21310abcdb0949bf (patch) | |
tree | eda3ea44dba48dbb71b7619ba7855cfbc781d6ba /bin/pax/pax.c | |
parent | 8fc0ebea6edd62db8b1eae93ed265642d1a7d665 (diff) |
fix one signal race bug, and mark the others that remain much more
specifically
ok nicm
Diffstat (limited to 'bin/pax/pax.c')
-rw-r--r-- | bin/pax/pax.c | 21 |
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); } /* |