pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/archivers/pax/files sync with src:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/ed5e4e82b997
branches:  trunk
changeset: 477060:ed5e4e82b997
user:      grant <grant%pkgsrc.org@localhost>
date:      Sat Jun 26 12:42:02 2004 +0000

description:
sync with src:

don't attempt to remove the current directory.

diffstat:

 archivers/pax/files/file_subs.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r 4defe237e6a5 -r ed5e4e82b997 archivers/pax/files/file_subs.c
--- a/archivers/pax/files/file_subs.c   Sat Jun 26 11:23:15 2004 +0000
+++ b/archivers/pax/files/file_subs.c   Sat Jun 26 12:42:02 2004 +0000
@@ -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 @@
                /*
                 * 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 @@
        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);



Home | Main Index | Thread Index | Old Index