From 663b3eaa4708af30c6666f398e3fb28f15af5228 Mon Sep 17 00:00:00 2001 From: grant Date: Sat, 26 Jun 2004 12:42:02 +0000 Subject: sync with src: don't attempt to remove the current directory. --- archivers/pax/files/file_subs.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'archivers') diff --git a/archivers/pax/files/file_subs.c b/archivers/pax/files/file_subs.c index f321ae76ae4..5fc12c81346 100644 --- a/archivers/pax/files/file_subs.c +++ b/archivers/pax/files/file_subs.c @@ -1,4 +1,4 @@ -/* $NetBSD: file_subs.c,v 1.5 2004/06/20 10:11:02 grant Exp $ */ +/* $NetBSD: file_subs.c,v 1.6 2004/06/26 12:42:02 grant Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -44,7 +44,7 @@ #if 0 static char sccsid[] = "@(#)file_subs.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: file_subs.c,v 1.5 2004/06/20 10:11:02 grant Exp $"); +__RCSID("$NetBSD: file_subs.c,v 1.6 2004/06/26 12:42:02 grant Exp $"); #endif #endif /* not lint */ @@ -364,7 +364,7 @@ mk_link(char *to, struct stat *to_sb, char *from, int ign) /* * try to get rid of the file, based on the type */ - if (S_ISDIR(sb.st_mode)) { + if (S_ISDIR(sb.st_mode) && strcmp(from, ".") != 0) { if (rmdir(from) < 0) { syswarn(1, errno, "Cannot remove %s", from); return(-1); @@ -619,8 +619,13 @@ unlnk_exist(char *name, int type) if (S_ISDIR(sb.st_mode)) { /* * try to remove a directory, if it fails and we were going to - * create a directory anyway, tell the caller (return a 1) + * create a directory anyway, tell the caller (return a 1). + * + * don't try to remove the directory if the name is "." + * otherwise later file/directory creation fails. */ + if (strcmp(name, ".") == 0) + return(1); if (rmdir(name) < 0) { if (type == PAX_DIR) return(1); -- cgit v1.2.3