Subject: bin/8014: [PATCH] Arithmetic(6) cleanup
To: None <gnats-bugs@gnats.netbsd.org>
From: Joseph Myers <jsm28@cam.ac.uk>
List: netbsd-bugs
Date: 07/17/1999 02:36:06
>Number:         8014
>Category:       bin
>Synopsis:       [PATCH] Arithmetic(6) cleanup
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 17 02:35:00 1999
>Last-Modified:
>Originator:     Joseph S. Myers
>Organization:
Trinity College, University of Cambridge, UK
>Release:        NetBSD-current of 1999-07-16
>Environment:
[
System: Linux decomino 2.2.10 #1 Mon Jun 14 07:48:53 UTC 1999 i686 unknown
Architecture: i686
]
>Description:

This patch (a) makes arithmetic(6) revoke any setgid privileges it got
from dm; (b) marks an unused parameter as such.  (These types of
changes were previously decided to be acceptable - see bin/6557.)

>How-To-Repeat:

>Fix:

diff -ruN arithmetic/arithmetic.c arithmetic+/arithmetic.c
--- arithmetic/arithmetic.c	Mon Sep 14 11:04:47 1998
+++ arithmetic+/arithmetic.c	Fri Jan  8 20:24:27 1999
@@ -122,6 +122,9 @@
 	extern int optind;
 	int ch, cnt;
 
+	/* Revoke setgid privileges */
+	setregid(getgid(), getgid());
+
 	while ((ch = getopt(argc, argv, "r:o:")) != -1)
 		switch(ch) {
 		case 'o': {
@@ -162,7 +165,7 @@
 /* Handle interrupt character.  Print score and exit. */
 void
 intr(dummy)
-	int dummy;
+	int dummy __attribute__((__unused__));
 {
 	showstats();
 	exit(0);
>Audit-Trail:
>Unformatted: