summaryrefslogtreecommitdiff
path: root/archivers/pax
diff options
context:
space:
mode:
authorgrant <grant>2004-06-26 12:42:02 +0000
committergrant <grant>2004-06-26 12:42:02 +0000
commita22fa2076b6d3d37b933f6be46c70d3edb907f5f (patch)
tree0a5a6fbd98f235ec0896a55d22cce3b516edf149 /archivers/pax
parent5c8593850a6aa427149dd4b27037c7bf48398d78 (diff)
downloadpkgsrc-a22fa2076b6d3d37b933f6be46c70d3edb907f5f.tar.gz
sync with src:
don't attempt to remove the current directory.
Diffstat (limited to 'archivers/pax')
-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);