PR/25207: Hubert Feyrer: tar cores on certain archive contents

Don't forget to cleanup xtmp_name when we fail to create the temporary file.
This commit is contained in:
christos 2004-04-20 20:00:37 +00:00
parent 1f747cc909
commit af4f4c568a
1 changed files with 3 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: file_subs.c,v 1.41 2004/02/13 23:10:14 matt Exp $ */ /* $NetBSD: file_subs.c,v 1.42 2004/04/20 20:00:37 christos Exp $ */
/*- /*-
* Copyright (c) 1992 Keith Muller. * Copyright (c) 1992 Keith Muller.
@ -42,7 +42,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)file_subs.c 8.1 (Berkeley) 5/31/93"; static char sccsid[] = "@(#)file_subs.c 8.1 (Berkeley) 5/31/93";
#else #else
__RCSID("$NetBSD: file_subs.c,v 1.41 2004/02/13 23:10:14 matt Exp $"); __RCSID("$NetBSD: file_subs.c,v 1.42 2004/04/20 20:00:37 christos Exp $");
#endif #endif
#endif /* not lint */ #endif /* not lint */
@ -118,6 +118,7 @@ file_creat(ARCHD *arcn)
if (nodirs || chk_path(arcn->name,arcn->sb.st_uid,arcn->sb.st_gid) < 0) { if (nodirs || chk_path(arcn->name,arcn->sb.st_uid,arcn->sb.st_gid) < 0) {
(void)fflush(listf); (void)fflush(listf);
syswarn(1, oerrno, "Cannot create %s", arcn->tmp_name); syswarn(1, oerrno, "Cannot create %s", arcn->tmp_name);
xtmp_name = NULL;
free(arcn->tmp_name); free(arcn->tmp_name);
arcn->tmp_name = NULL; arcn->tmp_name = NULL;
return(-1); return(-1);