diff --git a/bin/pax/extern.h b/bin/pax/extern.h index 90b7e61f5def..d5f4e025d22f 100644 --- a/bin/pax/extern.h +++ b/bin/pax/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.40 2003/10/13 07:41:22 agc Exp $ */ +/* $NetBSD: extern.h,v 1.41 2004/02/13 23:10:14 matt Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -143,6 +143,7 @@ int bcpio_wr(ARCHD *); * file_subs.c */ extern char *gnu_name_string, *gnu_link_string; +extern char *xtmp_name; int file_creat(ARCHD *); void file_close(ARCHD *, int); int lnk_creat(ARCHD *); diff --git a/bin/pax/file_subs.c b/bin/pax/file_subs.c index 8be67b1b9a70..be65b2099330 100644 --- a/bin/pax/file_subs.c +++ b/bin/pax/file_subs.c @@ -1,4 +1,4 @@ -/* $NetBSD: file_subs.c,v 1.40 2004/02/13 08:27:12 matt Exp $ */ +/* $NetBSD: file_subs.c,v 1.41 2004/02/13 23:10:14 matt Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)file_subs.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: file_subs.c,v 1.40 2004/02/13 08:27:12 matt Exp $"); +__RCSID("$NetBSD: file_subs.c,v 1.41 2004/02/13 23:10:14 matt Exp $"); #endif #endif /* not lint */ @@ -62,6 +62,8 @@ __RCSID("$NetBSD: file_subs.c,v 1.40 2004/02/13 08:27:12 matt Exp $"); #include "extern.h" #include "options.h" +char *xtmp_name; + static int mk_link(char *,struct stat *,char *, int); @@ -96,6 +98,9 @@ file_creat(ARCHD *arcn) syswarn(1, errno, "Cannot malloc %d bytes", arcn->nlen + 8); return(-1); } + if (xtmp_name) + abort(); + xtmp_name = arcn->tmp_name; for (;;) { /* @@ -178,6 +183,7 @@ file_close(ARCHD *arcn, int fd) free(arcn->tmp_name); arcn->tmp_name = NULL; + xtmp_name = NULL; } /* diff --git a/bin/pax/pax.c b/bin/pax/pax.c index 987463cf028d..cd2a3f1cd649 100644 --- a/bin/pax/pax.c +++ b/bin/pax/pax.c @@ -1,4 +1,4 @@ -/* $NetBSD: pax.c,v 1.32 2004/02/13 11:36:08 wiz Exp $ */ +/* $NetBSD: pax.c,v 1.33 2004/02/13 23:10:14 matt Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -44,7 +44,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\ #if 0 static char sccsid[] = "@(#)pax.c 8.2 (Berkeley) 4/18/94"; #else -__RCSID("$NetBSD: pax.c,v 1.32 2004/02/13 11:36:08 wiz Exp $"); +__RCSID("$NetBSD: pax.c,v 1.33 2004/02/13 23:10:14 matt Exp $"); #endif #endif /* not lint */ @@ -342,6 +342,9 @@ sig_cleanup(int which_sig) else tty_warn(0, "Signal caught, cleaning up."); + /* delete any open temporary file */ + if (xtmp_name) + (void)unlink(xtmp_name); ar_close(); proc_dir(); if (tflag)