Source-Changes-HG archive

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

[src/netbsd-1-5]: src/usr.sbin/pkg_install/add Pull up revision 1.20 (request...



details:   https://anonhg.NetBSD.org/src/rev/5c6959d1afa4
branches:  netbsd-1-5
changeset: 491021:5c6959d1afa4
user:      he <he%NetBSD.org@localhost>
date:      Fri Mar 30 22:19:58 2001 +0000

description:
Pull up revision 1.20 (requested by hubertf):
  Correctly set exit code != 0 if package file cannot be found.

diffstat:

 usr.sbin/pkg_install/add/main.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (66 lines):

diff -r bd2c38bc2f60 -r 5c6959d1afa4 usr.sbin/pkg_install/add/main.c
--- a/usr.sbin/pkg_install/add/main.c   Fri Mar 30 22:17:32 2001 +0000
+++ b/usr.sbin/pkg_install/add/main.c   Fri Mar 30 22:19:58 2001 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: main.c,v 1.15.2.3 2001/03/20 17:55:48 he Exp $ */
+/*     $NetBSD: main.c,v 1.15.2.4 2001/03/30 22:19:58 he Exp $ */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char *rcsid = "from FreeBSD Id: main.c,v 1.16 1997/10/08 07:45:43 charnier Exp";
 #else
-__RCSID("$NetBSD: main.c,v 1.15.2.3 2001/03/20 17:55:48 he Exp $");
+__RCSID("$NetBSD: main.c,v 1.15.2.4 2001/03/30 22:19:58 he Exp $");
 #endif
 #endif
 
@@ -62,7 +62,7 @@
 int
 main(int argc, char **argv)
 {
-       int     ch, error;
+       int     ch, error=0;
        lpkg_head_t pkgs;
        lpkg_t *lpp;
        char   *cp;
@@ -155,11 +155,13 @@
                                                    if (!(cp = realpath(tmp, pkgname))) {
                                                            lpp = NULL;
                                                            warn("realpath failed for '%s'", tmp);
+                                                           error++;
                                                    } else
                                                            lpp = alloc_lpkg(cp);
                                            } else {
                                                    lpp = NULL;
                                                    warnx("can't find package pattern '%s'", *argv);
+                                                   error++;
                                            }
                                } else {
                                        /* Maybe just a pkg name w/o pattern was given */
@@ -179,6 +181,7 @@
                                        if (!(cp = realpath(tmp2, pkgname))) {
                                                lpp = NULL;
                                                warn("realpath failed for '%s'", tmp2);
+                                               error++;
                                        } else
                                                lpp = alloc_lpkg(cp);
                                } else {
@@ -187,6 +190,7 @@
                                        if (!(cp = fileFindByPath(NULL, *argv))) {
                                                lpp = NULL;
                                                warnx("can't find package '%s'", *argv);
+                                               error++;
                                        } else
                                                lpp = alloc_lpkg(cp);
                                        }
@@ -202,7 +206,8 @@
        else if (ch > 1 && AddMode == MASTER)
                warnx("only one package name may be specified with master mode"),
                    usage();
-       if ((error = pkg_perform(&pkgs)) != 0) {
+       error += pkg_perform(&pkgs);
+       if (error  != 0) {
                if (Verbose)
                        warnx("%d package addition(s) failed", error);
                exit(1);



Home | Main Index | Thread Index | Old Index