summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgrant <grant@pkgsrc.org>2004-06-26 12:42:02 +0000
committergrant <grant@pkgsrc.org>2004-06-26 12:42:02 +0000
commit663b3eaa4708af30c6666f398e3fb28f15af5228 (patch)
tree0a5a6fbd98f235ec0896a55d22cce3b516edf149
parent79211143f00bf89b209b4ae92f6639012342a082 (diff)
downloadpkgsrc-663b3eaa4708af30c6666f398e3fb28f15af5228.tar.gz
sync with src:
don't attempt to remove the current directory.
-rw-r--r--archivers/pax/files/file_subs.c13
1 files changed, 9 insertions, 4 deletions
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);