Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 May 2010 08:44:43 GMT
From:      Garrett Cooper <gcooper@FreeBSD.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/146857: [patch] [pkg_install] fix missing error call in uname check added to pkg_version in r206043
Message-ID:  <201005230844.o4N8ihbc049828@www.freebsd.org>
Resent-Message-ID: <201005230850.o4N8o1Ns029572@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         146857
>Category:       bin
>Synopsis:       [patch] [pkg_install] fix missing error call in uname check added to pkg_version in r206043
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 23 08:50:01 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Garrett Cooper
>Release:        9-CURRENT
>Organization:
Cisco Systems, Inc.
>Environment:
FreeBSD bayonetta.local 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r206173M: Mon Apr 26 22:45:06 PDT 2010     root@bayonetta.local:/usr/obj/usr/src/sys/BAYONETTA.ata  amd64
>Description:
One of the error checks wasn't properly integrated into r206043 as part of bin/145101 (it was in the 2nd patch, not the first one).

This patch also reorders the headers so that it makes the actual dependencies for libpkg more apparent and fixes indentation according to jkh's `coding style' in one spot.
>How-To-Repeat:
These are error conditions that won't occur 99.9% of the time (unless uname(2) fails), but will occur given proper circumstances.
>Fix:
See attached patch.

Patch attached with submission follows:

Index: perform.c
===================================================================
--- perform.c	(revision 208438)
+++ perform.c	(working copy)
@@ -21,12 +21,15 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#include <pkg.h>
-#include "version.h"
+#include <sys/param.h>
+#include <stdio.h>
 #include <err.h>
 #include <fetch.h>
 #include <signal.h>
 
+#include <pkg.h>
+#include "version.h"
+
 FILE *IndexFile;
 char IndexPath[PATH_MAX] = "";
 struct index_head Index = SLIST_HEAD_INITIALIZER(Index);
@@ -56,10 +59,11 @@
     struct utsname u;
 
     if (uname(&u) == -1) {
-	warn("%s(): failed to determine uname information", __func__);
+	warn("%s: failed to determine uname information", __func__);
 	return 1;
     } else if ((rel_major_ver = (int) strtol(u.release, NULL, 10)) <= 0) {
-
+	warnx("%s: bad release version specified: %s", __func__, u.release);
+	return 1;
     }
 
     /*
@@ -82,10 +86,10 @@
 	pat[1] = NULL;
 	MatchType = RegexExtended ? MATCH_EREGEX : MATCH_REGEX;
 	patterns = pat;
-     } else {
+    } else {
 	MatchType = MATCH_ALL;
 	patterns = NULL;
-     }
+    }
 
     if (LookUpOrigin != NULL)
 	pkgs = matchbyorigin(LookUpOrigin, &err_cnt);


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201005230844.o4N8ihbc049828>