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/lib Pull over v1.59-v1.61 f...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/153112d1bd9a
branches:  trunk
changeset: 510785:153112d1bd9a
user:      wiz <wiz%pkgsrc.org@localhost>
date:      Tue Apr 04 06:36:12 2006 +0000

description:
Pull over v1.59-v1.61 from src/usr.sbin:
revision 1.61
date: 2006/03/17 17:46:44;  author: hubertf;  state: Exp;  lines: +4 -3
Put check if "best" is empty back into the right place, messed up
in previous commit.
Noted by yamt@
----------------------------
revision 1.60
date: 2006/03/17 02:20:46;  author: hubertf;  state: Exp;  lines: +10 -4
findbestmatchingname_fn(): catch possible problems if best (vp)
contains some strange name (shouldn't happen, but ...)

Coverity CID 869
----------------------------
revision 1.59
date: 2006/03/17 02:10:55;  author: hubertf;  state: Exp;  lines: +8 -7
findbestmatchingname_fn(): only do something sensible if the pointer
handed in is actually usable (not NULL)

Fixes Coverity ID 870

diffstat:

 pkgtools/pkg_install/files/lib/str.c |  26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

diffs (55 lines):

diff -r af75471137a0 -r 153112d1bd9a pkgtools/pkg_install/files/lib/str.c
--- a/pkgtools/pkg_install/files/lib/str.c      Tue Apr 04 06:34:25 2006 +0000
+++ b/pkgtools/pkg_install/files/lib/str.c      Tue Apr 04 06:36:12 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: str.c,v 1.16 2006/01/08 12:25:06 wiz Exp $     */
+/*     $NetBSD: str.c,v 1.17 2006/04/04 06:36:12 wiz Exp $     */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -11,7 +11,7 @@
 #if 0
 static const char *rcsid = "Id: str.c,v 1.5 1997/10/08 07:48:21 charnier Exp";
 #else
-__RCSID("$NetBSD: str.c,v 1.16 2006/01/08 12:25:06 wiz Exp $");
+__RCSID("$NetBSD: str.c,v 1.17 2006/04/04 06:36:12 wiz Exp $");
 #endif
 #endif
 
@@ -307,9 +307,15 @@
                if (best_version) {
                        /* skip '-' if any version found */
                        best_version++;
+                       strip_txz(best_no_sfx, NULL, best_version);
+                       best_version = best_no_sfx;
+               } else {
+                       /* how did this end up in 'best'?
+                        * Shouldn't happen... */
+                       fprintf(stderr,
+                               "'%s' has no usable package(version)\n",
+                               best);
                }
-               strip_txz(best_no_sfx, NULL, best_version);
-               best_version = best_no_sfx;
        }
 
        if (found_version == NULL) {
@@ -318,11 +324,13 @@
        } else {
                /* if best_version==NULL only if best==NULL
                 * (or best[0]='\0') */
-               if (best == NULL || best[0] == '\0' ||
-                   dewey_cmp(found_version, DEWEY_GT, best_version)) {
-                       /* found pkg(version) is bigger than current "best"
-                        * version - remember! */
-                       strcpy(best, found);
+               if (best != NULL) {
+                       if (best[0] == '\0'
+                           || dewey_cmp(found_version, DEWEY_GT, best_version)) {
+                               /* found pkg(version) is bigger than current "best"
+                                * version - remember! */
+                               strcpy(best, found);
+                       }
                }
        }
 



Home | Main Index | Thread Index | Old Index