When pax catches a signal and cleans up, make sure to remove any temporary

file that was being extracted to.  This will prevent pax from leaving
droppings when you hit ^C.
This commit is contained in:
matt 2004-02-13 23:10:14 +00:00
parent d02c32fcce
commit 8fbcc555cf
3 changed files with 15 additions and 5 deletions

View File

@ -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 *);

View File

@ -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;
}
/*

View File

@ -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)