pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files/add Pull over this change f...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/6acd8b887ca0
branches:  trunk
changeset: 497339:6acd8b887ca0
user:      hubertf <hubertf%pkgsrc.org@localhost>
date:      Mon Jul 25 13:03:59 2005 +0000

description:
Pull over this change from src/usr.sbin/pkg_install (-current):

| Modified Files:
|         src/usr.sbin/pkg_install/add: extract.c
|
| Log Message:
| Fix 'pkg_add -R' handling - not registering really means not touching
| the pkgdb too - useful for pkg_add as non-root!
|
|
| To generate a diff of this commit:
| cvs rdiff -r1.34 -r1.35 src/usr.sbin/pkg_install/add/extract.c

diffstat:

 pkgtools/pkg_install/files/add/extract.c |  32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)

diffs (74 lines):

diff -r 35952db813d7 -r 6acd8b887ca0 pkgtools/pkg_install/files/add/extract.c
--- a/pkgtools/pkg_install/files/add/extract.c  Mon Jul 25 12:50:59 2005 +0000
+++ b/pkgtools/pkg_install/files/add/extract.c  Mon Jul 25 13:03:59 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: extract.c,v 1.11 2005/01/07 11:58:12 agc Exp $ */
+/*     $NetBSD: extract.c,v 1.12 2005/07/25 13:03:59 hubertf Exp $     */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -11,7 +11,7 @@
 #if 0
 static const char *rcsid = "FreeBSD - Id: extract.c,v 1.17 1997/10/08 07:45:35 charnier Exp";
 #else
-__RCSID("$NetBSD: extract.c,v 1.11 2005/01/07 11:58:12 agc Exp $");
+__RCSID("$NetBSD: extract.c,v 1.12 2005/07/25 13:03:59 hubertf Exp $");
 #endif
 #endif
 
@@ -152,10 +152,12 @@
        last_file = NULL;
        Directory = home;
 
-       /* Open Package Database for writing */
-       if (!pkgdb_open(ReadWrite)) {
-               cleanup(0);
-               err(EXIT_FAILURE, "can't open pkgdb");
+       if (!NoRecord) {
+               /* Open Package Database for writing */
+               if (!pkgdb_open(ReadWrite)) {
+                       cleanup(0);
+                       err(EXIT_FAILURE, "can't open pkgdb");
+               }
        }
        /* Do it */
        while (p) {
@@ -203,8 +205,8 @@
                                        }
                                }
                                if (rename(p->name, try) == 0) {
-                                       /* note in pkgdb */
-                                       {
+                                       if (!NoRecord) {
+                                               /* note in pkgdb */
                                                char   *s, t[MaxPathSize];
                                                int     rc;
 
@@ -261,11 +263,12 @@
                                        }
                                        perm_count += add_count;
 
-                                       /* note in pkgdb */
-                                       /* XXX would be better to store in PUSHOUT, but
-                                        * that would probably affect too much code I prefer
-                                        * not to touch - HF */
-                                       {
+                                       if (!NoRecord) {
+                                               /* note in pkgdb */
+                                               /* XXX would be better to store in PUSHOUT, but
+                                                * that would probably affect too much code I prefer
+                                                * not to touch - HF */
+                                               
                                                char   *s, t[MaxPathSize], *u;
                                                int     rc;
 
@@ -343,7 +346,8 @@
                p = p->next;
        }
        PUSHOUT(Directory);
-       pkgdb_close();
+       if (!NoRecord)
+               pkgdb_close();
        free(perm_args);
        free(where_args);
        return 1;



Home | Main Index | Thread Index | Old Index