kern/81371: [PATCH] ng_socket: 2nd "int error" hides real error code

Wojciech A. Koszek dunstan at
Sun May 22 20:40:07 GMT 2005

>Number:         81371
>Category:       kern
>Synopsis:       [PATCH] ng_socket: 2nd "int error" hides real error code
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 22 20:40:06 GMT 2005
>Originator:     Wojciech A. Koszek
>Release:        FreeBSD 5.4-STABLE i386
System: FreeBSD 5.4-STABLE FreeBSD 5.4-STABLE #5: Sun May 8 11:57:11 CEST 2005 dunstan at i386

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).
root at dunstan:(/)# ls /boot/kernel/ng_device.ko
ls: /boot/kernel/ng_device.ko: No such file or directory
root at dunstan:(/)# ngctl 
+ mkpeer . device d d
+ list
There are 1 total nodes:
  Name: ngctl1040       Type: socket          ID: 00000001   Num hooks: 0

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
< 			int error;
--- diff.0.ng_socket.c ends here ---


More information about the freebsd-bugs mailing list