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/add extract_plist() should inform calle...



details:   https://anonhg.NetBSD.org/src/rev/c4d414c625c1
branches:  trunk
changeset: 488035:c4d414c625c1
user:      sjg <sjg%NetBSD.org@localhost>
date:      Fri Jun 16 23:49:17 2000 +0000

description:
extract_plist() should inform caller when it aborts extract

diffstat:

 usr.sbin/pkg_install/add/extract.c |  13 +++++++++----
 usr.sbin/pkg_install/add/perform.c |   9 ++++++---
 2 files changed, 15 insertions(+), 7 deletions(-)

diffs (74 lines):

diff -r 35c3ecdb4142 -r c4d414c625c1 usr.sbin/pkg_install/add/extract.c
--- a/usr.sbin/pkg_install/add/extract.c        Fri Jun 16 23:48:23 2000 +0000
+++ b/usr.sbin/pkg_install/add/extract.c        Fri Jun 16 23:49:17 2000 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: extract.c,v 1.20 1999/08/24 00:48:38 hubertf Exp $     */
+/*     $NetBSD: extract.c,v 1.21 2000/06/16 23:49:17 sjg Exp $ */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #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.20 1999/08/24 00:48:38 hubertf Exp $");
+__RCSID("$NetBSD: extract.c,v 1.21 2000/06/16 23:49:17 sjg Exp $");
 #endif
 #endif
 
@@ -86,7 +86,11 @@
        }
 }
 
-void
+
+/*
+ * Return 0 on error, 1 for success.
+ */
+int
 extract_plist(char *home, package_t *pkg)
 {
        plist_t *p = pkg->head;
@@ -162,7 +166,7 @@
                                                                    "unable to back up %s to %s, aborting pkg_add",
                                                                    try, pf);
                                                                rollback(PkgName, home, pkg->head, p);
-                                                               return;
+                                                               return 0;
                                                        }
                                                }
                                        }
@@ -311,4 +315,5 @@
        }
        PUSHOUT(Directory);
        pkgdb_close();
+       return 1;
 }
diff -r 35c3ecdb4142 -r c4d414c625c1 usr.sbin/pkg_install/add/perform.c
--- a/usr.sbin/pkg_install/add/perform.c        Fri Jun 16 23:48:23 2000 +0000
+++ b/usr.sbin/pkg_install/add/perform.c        Fri Jun 16 23:49:17 2000 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: perform.c,v 1.51 2000/05/16 15:59:16 hubertf Exp $     */
+/*     $NetBSD: perform.c,v 1.52 2000/06/16 23:49:17 sjg Exp $ */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.44 1997/10/13 15:03:46 jkh Exp";
 #else
-__RCSID("$NetBSD: perform.c,v 1.51 2000/05/16 15:59:16 hubertf Exp $");
+__RCSID("$NetBSD: perform.c,v 1.52 2000/06/16 23:49:17 sjg Exp $");
 #endif
 #endif
 
@@ -548,7 +548,10 @@
 
        /* Now finally extract the entire show if we're not going direct */
        if (!inPlace && !Fake)
-               extract_plist(".", &Plist);
+           if (!extract_plist(".", &Plist)) {
+               code = 1;
+               goto fail;
+           }
 
        if (!Fake && fexists(MTREE_FNAME)) {
                if (Verbose)



Home | Main Index | Thread Index | Old Index