From dan@obluda.cz  Sun Sep 12 02:37:52 2004
Return-Path: <dan@obluda.cz>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id E08B416A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 12 Sep 2004 02:37:52 +0000 (GMT)
Received: from kulesh.obluda.cz (kulesh.obluda.cz [193.179.22.243])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 4448643D39
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 12 Sep 2004 02:37:51 +0000 (GMT)
	(envelope-from dan@obluda.cz)
Received: from kulesh.obluda.cz (localhost.eunet.cz [127.0.0.1])
	by kulesh.obluda.cz (8.13.1/8.13.1) with ESMTP id i8C2bnCw007103
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 12 Sep 2004 04:37:50 +0200 (CEST)
	(envelope-from dan@obluda.cz)
Received: (from root@localhost)
	by kulesh.obluda.cz (8.13.1/8.13.1/Submit) id i8C2bnFG007102
	for FreeBSD-gnats-submit@freebsd.org; Sun, 12 Sep 2004 04:37:49 +0200 (CEST)
	(envelope-from dan@obluda.cz)
Message-Id: <200409120237.i8C2bnFG007102@kulesh.obluda.cz>
Date: Sun, 12 Sep 2004 04:37:49 +0200 (CEST)
From: Dan Lukes <dan@obluda.cz>
Reply-To: Dan Lukes <dan@obluda.cz>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] cleanup of the usr.sbin/sliplogin code
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         71621
>Category:       bin
>Synopsis:       [patch] sliplogin(8): cleanup of the usr.sbin/sliplogin code
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 12 02:40:26 GMT 2004
>Closed-Date:    Sun Dec 12 16:00:59 UTC 2010
>Last-Modified:  Sun Dec 12 16:00:59 UTC 2010
>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:
State-Changed-From-To: open->patched  
State-Changed-By: brucec 
State-Changed-When: Wed Jun 23 14:59:24 UTC 2010 
State-Changed-Why:  
sliplogin no longer exists in 8.0. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=71621 
State-Changed-From-To: patched->closed 
State-Changed-By: uqs 
State-Changed-When: Sun Dec 12 15:59:07 UTC 2010 
State-Changed-Why:  
sliplogin(8) was removed from head in r190751, and a direct commit 
to a stable branch is unlikely for this PR. Sorry. 

Thank you for your submission! 

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