Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/pkg_install/lib Print appropriate warning if the di...



details:   https://anonhg.NetBSD.org/src/rev/47b6eae2641c
branches:  trunk
changeset: 485517:47b6eae2641c
user:      hubertf <hubertf%NetBSD.org@localhost>
date:      Sat Apr 29 22:39:58 2000 +0000

description:
Print appropriate warning if the directory of a @dirrm is not present
at all.

Pointed out & fix reviewed by Thomas Klausner.

diffstat:

 usr.sbin/pkg_install/lib/plist.c |  15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diffs (42 lines):

diff -r 8e070b245167 -r 47b6eae2641c usr.sbin/pkg_install/lib/plist.c
--- a/usr.sbin/pkg_install/lib/plist.c  Sat Apr 29 22:18:31 2000 +0000
+++ b/usr.sbin/pkg_install/lib/plist.c  Sat Apr 29 22:39:58 2000 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: plist.c,v 1.24 1999/11/29 20:09:56 hubertf Exp $       */
+/*     $NetBSD: plist.c,v 1.25 2000/04/29 22:39:58 hubertf Exp $       */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: plist.c,v 1.24 1997/10/08 07:48:15 charnier Exp";
 #else
-__RCSID("$NetBSD: plist.c,v 1.24 1999/11/29 20:09:56 hubertf Exp $");
+__RCSID("$NetBSD: plist.c,v 1.25 2000/04/29 22:39:58 hubertf Exp $");
 #endif
 #endif
 
@@ -425,16 +425,21 @@
 
                case PLIST_DIR_RM:
                        (void) snprintf(tmp, sizeof(tmp), "%s/%s", Where, p->name);
-                       if (!isdir(tmp)) {
-                               warnx("attempting to delete file `%s' as a directory\n"
+                       if (fexists(tmp)) {
+                           if (!isdir(tmp)) {
+                               warnx("cannot remove `%s' as a directory\n"
                                    "this packing list is incorrect - ignoring delete request", tmp);
-                       } else {
+                           } else {
                                if (Verbose)
                                        printf("Delete directory %s\n", tmp);
                                if (!Fake && delete_hierarchy(tmp, ign_err, FALSE)) {
                                        warnx("unable to completely remove directory '%s'", tmp);
                                        fail = FAIL;
                                }
+                           }
+                       } else {
+                           warnx("cannot remove non-existant directory `%s'\n"
+                                   "this packing list is incorrect - ignoring delete request", tmp)
                        }
                        last_file = p->name;
                        break;



Home | Main Index | Thread Index | Old Index