Subject: bin/6739: compiler warnings in wsconsctl
To: None <gnats-bugs@gnats.netbsd.org>
From: None <deberg@MIT.EDU>
List: netbsd-bugs
Date: 01/06/1999 00:17:49
>Number:         6739
>Category:       bin
>Synopsis:       cc warns that variables in wsconsctl.c are used uninitialized
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan  5 21:35:00 1999
>Last-Modified:
>Originator:     matt debergalis
>Organization:
matt debergalis <deberg@mit.edu> KB1CTH
finger deberg@ai.mit.edu for PGP key
home 617.492.1448
>Release:        19990105
>Environment:
System: NetBSD sunrise.ne.mediaone.net 1.3I NetBSD 1.3I (SUNRISE) #2: Tue Dec 29 14:21:21 EST 1998 deberg@sunrise.ne.mediaone.net:/src/netbsd/src/sys/arch/i386/compile/SUNRISE i386

>Description:
        in wsconsctl.c:main(), cc (not egcs) complains that field_tab,
        field_tab_len, getval, and putval may all be used without being
        initialized.

cc -O  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Werror   -I. -c wsconsctl.c
cc1: warnings being treated as errors
wsconsctl.c: In function `main':
wsconsctl.c:86: warning: `field_tab' might be used uninitialized in this function
wsconsctl.c:87: warning: `field_tab_len' might be used uninitialized in this function
wsconsctl.c:88: warning: `getval' might be used uninitialized in this function
wsconsctl.c:89: warning: `putval' might be used uninitialized in this function
*** Error code 1

>How-To-Repeat:
>Fix:
Index: wsconsctl.c
===================================================================
RCS file: /src/cvsroot-netbsd/netbsd/src/sbin/wsconsctl/wsconsctl.c,v
retrieving revision 1.1.1.1
diff -u -c -r1.1.1.1 wsconsctl.c
cvs diff: conflicting specifications of output style
*** wsconsctl.c	1999/01/04 01:34:40	1.1.1.1
--- wsconsctl.c	1999/01/06 05:14:49
***************
*** 94,99 ****
--- 94,103 ----
  	mflag = 0;
  	wflag = 0;
  	file = NULL;
+ 	field_tab = NULL;
+ 	field_tab_len = 0;
+ 	getval = NULL;
+ 	putval = NULL;
  	sep = "=";
  
  	while ((ch = getopt(argc, argv, "adf:kmnw")) != -1) {
>Audit-Trail:
>Unformatted: