Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Sep 2004 04:37:49 +0200 (CEST)
From:      Dan Lukes <dan@obluda.cz>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/71621: [PATCH] cleanup of the usr.sbin/sliplogin code
Message-ID:  <200409120237.i8C2bnFG007102@kulesh.obluda.cz>
Resent-Message-ID: <200409120240.i8C2eQpJ087016@freefall.freebsd.org>

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

>Number:         71621
>Category:       bin
>Synopsis:       [PATCH] cleanup of the usr.sbin/sliplogin code
>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 Sep 12 02:40:26 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Dan Lukes
>Release:        FreeBSD 5.3-BETA3 i386
>Organization:
Obludarium
>Environment:
System: FreeBSD kulesh.obluda.cz 5.3-BETA3 FreeBSD 5.3-BETA3 #8: Sun Sep 5 07:06:40 CEST 2004 dan@kulesh.obluda.cz:/usr/obj/usr/src/sys/Dan i386
usr.sbin/sliplogin/sliplogin.c,v 1.15 2004/08/07 04:28:55 imp

>Description:
	There are more than 5000 warnings issued during "make buildworld".
Some of them are false positives, but some of them are sign of true errors.

	Nobody is upset by warnings due it's amount, so some errors remain
uncorrected.

	I want to cleanup the code-base from warnings, so warnings will
become "attention mark" again.

usr.sbin/sliplogin/sliplogin.c:31: warning: 'copyright' defined but not used
usr.sbin/sliplogin/sliplogin.c:37: warning: 'sccsid' defined but not used
usr.sbin/sliplogin/sliplogin.c:38: warning: 'rscid' defined but not used
usr.sbin/sliplogin/sliplogin.c:138: warning: missing braces around initializer
usr.sbin/sliplogin/sliplogin.c:319: warning: long int format, speed_t arg (arg 6)
usr.sbin/sliplogin/sliplogin.c:508: warning: long int format, speed_t arg (arg 6)
usr.sbin/sliplogin/sliplogin.c:530: warning: suggest parentheses around assignment used as truth value


>How-To-Repeat:
	N/A
>Fix:
*** usr.sbin/sliplogin/sliplogin.c.ORIG	Sun Aug  8 21:14:06 2004
--- usr.sbin/sliplogin/sliplogin.c	Mon Sep  6 18:15:46 2004
***************
*** 27,43 ****
   * SUCH DAMAGE.
   */
  
- #ifndef lint
- static char copyright[] =
- "@(#) Copyright (c) 1990, 1993\n\
- 	The Regents of the University of California.  All rights reserved.\n";
- #endif /* not lint */
- 
- #ifndef lint
- static char sccsid[] = "@(#)sliplogin.c	8.2 (Berkeley) 2/1/94";
- static char rscid[] = "@(#)$FreeBSD: src/usr.sbin/sliplogin/sliplogin.c,v 1.15 2004/08/07 04:28:55 imp Exp $";
- #endif /* not lint */
- 
  /*
   * sliplogin.c
   * [MUST BE RUN SUID, SLOPEN DOES A SUSER()!]
--- 27,32 ----
***************
*** 64,69 ****
--- 53,68 ----
   * /etc/slip.hosts file and if found fd0 is configured as in case 1.
   */
  
+ #include <sys/cdefs.h>
+ #ifndef lint
+ static const char copyright[] __unused =
+ "@(#) Copyright (c) 1990, 1993\n\
+ 	The Regents of the University of California.  All rights reserved.\n";
+ static const char sccsid[] __unused = "@(#)sliplogin.c	8.2 (Berkeley) 2/1/94";
+ #endif /* not lint */
+ 
+ __FBSDID("$FreeBSD: src/usr.sbin/sliplogin/sliplogin.c,v 1.15 2004/08/07 04:28:55 imp Exp $");
+ 
  #include <sys/param.h>
  #include <sys/socket.h>
  #include <sys/file.h>
***************
*** 135,144 ****
  	int	sm_or_flag;
  	int	sm_and_flag;
  }	 modes[] = {
! 	"normal",	0        , 0        ,
! 	"compress",	IFF_LINK0, IFF_LINK2,
! 	"noicmp",	IFF_LINK1, 0        ,
! 	"autocomp",	IFF_LINK2, IFF_LINK0,
  };
  
  void
--- 134,143 ----
  	int	sm_or_flag;
  	int	sm_and_flag;
  }	 modes[] = {
! 	{ "normal",	0        , 0         },
! 	{ "compress",	IFF_LINK0, IFF_LINK2 },
! 	{ "noicmp",	IFF_LINK1, 0         },
! 	{ "autocomp",	IFF_LINK2, IFF_LINK0 },
  };
  
  void
***************
*** 316,322 ****
  	if (access(logoutfile, R_OK|X_OK) == 0) {
  		char logincmd[2*MAXPATHLEN+32];
  
! 		(void) snprintf(logincmd, sizeof(logincmd), "%s %d %ld %s", logoutfile, unit, speed, loginargs);
  		(void) system(logincmd);
  	}
  	syslog(LOG_INFO, "closed %s slip unit %d (%s)\n", loginname, unit,
--- 315,321 ----
  	if (access(logoutfile, R_OK|X_OK) == 0) {
  		char logincmd[2*MAXPATHLEN+32];
  
! 		(void) snprintf(logincmd, sizeof(logincmd), "%s %d %ld %s", logoutfile, unit, (long int)speed, loginargs);
  		(void) system(logincmd);
  	}
  	syslog(LOG_INFO, "closed %s slip unit %d (%s)\n", loginname, unit,
***************
*** 504,510 ****
  
  
  	syslog(LOG_INFO, "attaching slip unit %d for %s\n", unit, loginname);
! 	(void)snprintf(logincmd, sizeof(logincmd), "%s %d %ld %s", loginfile, unit, speed,
  		      loginargs);
  	/*
  	 * aim stdout and errout at /dev/null so logincmd output won't
--- 503,509 ----
  
  
  	syslog(LOG_INFO, "attaching slip unit %d for %s\n", unit, loginname);
! 	(void)snprintf(logincmd, sizeof(logincmd), "%s %d %ld %s", loginfile, unit, (long int)speed,
  		      loginargs);
  	/*
  	 * aim stdout and errout at /dev/null so logincmd output won't
***************
*** 527,533 ****
  	 * to see whether changes are allowed (or just "route get").
  	 */
  	(void) setuid(0);
! 	if (s = system(logincmd)) {
  		syslog(LOG_ERR, "%s login failed: exit status %d from %s",
  		       loginname, s, loginfile);
  		exit(6);
--- 526,532 ----
  	 * to see whether changes are allowed (or just "route get").
  	 */
  	(void) setuid(0);
! 	if ((s = system(logincmd))) {
  		syslog(LOG_ERR, "%s login failed: exit status %d from %s",
  		       loginname, s, loginfile);
  		exit(6);
>Release-Note:
>Audit-Trail:
>Unformatted:



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