Module Name:    src
Committed By:   christos
Date:           Tue Aug 16 12:39:30 UTC 2011

Modified Files:
        src/usr.sbin/altq/altqd: Makefile altqd.c

Log Message:
remove gcc-4.5 hack and check fileno instead.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/altq/altqd/Makefile
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/altq/altqd/altqd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/altq/altqd/Makefile
diff -u src/usr.sbin/altq/altqd/Makefile:1.6 src/usr.sbin/altq/altqd/Makefile:1.7
--- src/usr.sbin/altq/altqd/Makefile:1.6	Tue Aug  9 09:04:28 2011
+++ src/usr.sbin/altq/altqd/Makefile	Tue Aug 16 08:39:29 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.6 2011/08/09 13:04:28 joerg Exp $
+#	$NetBSD: Makefile,v 1.7 2011/08/16 12:39:29 christos Exp $
 
 .include <bsd.own.mk>
 
@@ -17,8 +17,3 @@
 LDADD+=	-lutil -lm
 
 .include <bsd.prog.mk>
-
-# XXX
-.if ${HAVE_GCC} == 45
-COPTS.altqd.c+=	${${ACTIVE_CC} == "gcc":?-Wno-array-bounds:}
-.endif

Index: src/usr.sbin/altq/altqd/altqd.c
diff -u src/usr.sbin/altq/altqd/altqd.c:1.9 src/usr.sbin/altq/altqd/altqd.c:1.10
--- src/usr.sbin/altq/altqd/altqd.c:1.9	Sun Nov 26 06:38:07 2006
+++ src/usr.sbin/altq/altqd/altqd.c	Tue Aug 16 08:39:29 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: altqd.c,v 1.9 2006/11/26 11:38:07 peter Exp $	*/
+/*	$NetBSD: altqd.c,v 1.10 2011/08/16 12:39:29 christos Exp $	*/
 /*	$KAME: altqd.c,v 1.10 2002/02/20 10:42:26 kjc Exp $	*/
 /*
  * Copyright (c) 2001 Theo de Raadt
@@ -114,7 +114,7 @@
 int
 main(int argc, char **argv)
 {
-	int	i, c, maxfd, rval, qpsock;
+	int	i, c, maxfd, rval, qpsock, fd;
 	fd_set	fds, rfds;
 	FILE	*fp, *client[MAX_CLIENT];
 
@@ -216,8 +216,15 @@
 	FD_ZERO(&fds);
 	maxfd = 0;
 	if (fp != NULL) {
-		FD_SET(fileno(fp), &fds);
-		maxfd = MAX(maxfd, fileno(fp) + 1);
+	    fd = fileno(fp);
+	    if (fd == -1)
+		    LOG(LOG_ERR, 0, "bad file descriptor", QUIP_PATH);
+	} else
+		fd = -1;
+
+	if (fd != -1) {
+		FD_SET(fd, &fds);
+		maxfd = MAX(maxfd, fd + 1);
 	}
 	if (qpsock >= 0) {
 		FD_SET(qpsock, &fds);
@@ -252,7 +259,7 @@
 		 * if there is command input, read the input line,
 		 * parse it, and execute.
 		 */
-		if (fp && FD_ISSET(fileno(fp), &rfds)) {
+		if (fp && FD_ISSET(fd, &rfds)) {
 			rval = do_command(fp);
 			if (rval == 0) {
 				/* quit command or eof on input */
@@ -284,18 +291,18 @@
 			 * check input from a client via unix domain socket
 			 */
 			for (i = 0; i < MAX_CLIENT; i++) {
-				int fd;
+				int fd1;
 
 				if (client[i] == NULL)
 					continue;
-				fd = fileno(client[i]);
-				if (FD_ISSET(fd, &rfds)) {
+				fd1 = fileno(client[i]);
+				if (FD_ISSET(fd1, &rfds)) {
 					if (quip_input(client[i]) != 0 ||
 					    fflush(client[i]) != 0) {
 						/* connection closed */
 						fclose(client[i]);
 						client[i] = NULL;
-						FD_CLR(fd, &fds);
+						FD_CLR(fd1, &fds);
 					}
 				}
 			}

Reply via email to