Subject: bin/24863: check for correct return value in main.c pkg_info(1)
To: None <gnats-bugs@gnats.NetBSD.org>
From: Peter Postma <peter@pointless.nl>
List: netbsd-bugs
Date: 03/20/2004 19:25:29
>Number:         24863
>Category:       bin
>Synopsis:       check for correct return value in main.c pkg_info(1)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 20 18:26:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Peter Postma
>Release:        NetBSD 1.6ZK
>Organization:
>Environment:
System: NetBSD mercury.pointless.nl 1.6ZK NetBSD 1.6ZK (mercury) #27: Sat Mar 13 14:35:22 CET 2004 peter@mercury.pointless.nl:/usr/obj/sys/arch/sparc64/compile/mercury sparc64
Architecture: sparc64
Machine: sparc64
>Description:
	In usr.sbin/pkg_install/info/main.c: 

	pkgdb_open returns 0 or 1, so don't check if it's -1.
>How-To-Repeat:
>Fix:

Index: main.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/pkg_install/info/main.c,v
retrieving revision 1.38
diff -u -r1.38 main.c
--- main.c	6 Jan 2004 15:48:47 -0000	1.38
+++ main.c	20 Mar 2004 18:21:22 -0000
@@ -230,7 +230,7 @@
 
 	/* Get all the remaining package names, if any */
 	if (File2Pkg && !AllInstalled)
-		if (pkgdb_open(ReadOnly) == -1) {
+		if (!pkgdb_open(ReadOnly)) {
 			err(EXIT_FAILURE, "cannot open pkgdb");
 		}
 	while (*argv) {
>Release-Note:
>Audit-Trail:
>Unformatted: