From dunstan@freebsd.czest.pl  Sun May 22 20:35:37 2005
Return-Path: <dunstan@freebsd.czest.pl>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 1CC4F16A41C
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 22 May 2005 20:35:37 +0000 (GMT)
	(envelope-from dunstan@freebsd.czest.pl)
Received: from freebsd.czest.pl (silver.iplus.pl [80.48.250.4])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 73DC643D1D
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 22 May 2005 20:35:35 +0000 (GMT)
	(envelope-from dunstan@freebsd.czest.pl)
Received: from freebsd.czest.pl (freebsd.czest.pl [80.48.250.4])
	by freebsd.czest.pl (8.12.10/8.12.9) with ESMTP id j4MKkWLh050104
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 22 May 2005 20:46:32 GMT
	(envelope-from dunstan@freebsd.czest.pl)
Received: (from dunstan@localhost)
	by freebsd.czest.pl (8.12.10/8.12.9/Submit) id j4MKkVxg050103;
	Sun, 22 May 2005 20:46:31 GMT
	(envelope-from dunstan)
Message-Id: <200505222046.j4MKkVxg050103@freebsd.czest.pl>
Date: Sun, 22 May 2005 20:46:31 GMT
From: "Wojciech A. Koszek" <dunstan@freebsd.czest.pl>
Reply-To: "Wojciech A. Koszek" <dunstan@freebsd.czest.pl>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] ng_socket: 2nd "int error" hides real error code
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         81371
>Category:       kern
>Synopsis:       [netgraph] [patch] ng_socket: 2nd "int error" hides real error code
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    glebius
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 22 20:40:06 GMT 2005
>Closed-Date:    Thu Nov 03 11:44:46 GMT 2005
>Last-Modified:  Thu Nov 03 11:44:46 GMT 2005
>Originator:     Wojciech A. Koszek
>Release:        FreeBSD 5.4-STABLE i386
>Organization:
>Environment:
System: FreeBSD dunstan.freebsd.czest.pl 5.4-STABLE FreeBSD 5.4-STABLE #5: Sun May 8 11:57:11 CEST 2005 dunstan@dunstan.freebsd.czest.pl:/usr/obj/usr/src/sys/HOME8 i386


>Description:
There is a redundant declaration ("int error") in sys/netgraph/ng_socket.c. 
'error' is declared in ngc_send() and initialized with zero. Second 'error'
is declared in block responsible for loading needed Netgraph modules. If
module does not exist (linker_load_module()), 'error' in block's scope is
equal to 2, but 'error' in function's scope is returned while it's value is
not changed (still equal to zero).
>How-To-Repeat:
root@dunstan:(/)# ls /boot/kernel/ng_device.ko
ls: /boot/kernel/ng_device.ko: No such file or directory
root@dunstan:(/)# ngctl 
[..]
+ mkpeer . device d d
+ list
There are 1 total nodes:
  Name: ngctl1040       Type: socket          ID: 00000001   Num hooks: 0


>Fix:
Patch [diff.0.ng_socket.c] removes second declaration of error. 

--- diff.0.ng_socket.c begins here ---
Index: src/sys/netgraph/ng_socket.c
===================================================================
RCS file: /home/ncvs/src/sys/netgraph/ng_socket.c,v
retrieving revision 1.64
diff -r1.64 ng_socket.c
286d285
< 			int error;
--- diff.0.ng_socket.c ends here ---

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->patched 
State-Changed-By: glebius 
State-Changed-When: Mon May 23 13:50:11 GMT 2005 
State-Changed-Why:  
Good catch. Thanks! 


Responsible-Changed-From-To: freebsd-bugs->glebius 
Responsible-Changed-By: glebius 
Responsible-Changed-When: Mon May 23 13:50:11 GMT 2005 
Responsible-Changed-Why:  
Mine. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=81371 
State-Changed-From-To: patched->closed 
State-Changed-By: glebius 
State-Changed-When: Thu Nov 3 11:44:31 GMT 2005 
State-Changed-Why:  
Merged to RELENG_5. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=81371 
>Unformatted:
