Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/altq/altqd remove gcc-4.5 hack and check fileno ins...
details: https://anonhg.NetBSD.org/src/rev/3bb87de6ee18
branches: trunk
changeset: 768422:3bb87de6ee18
user: christos <christos%NetBSD.org@localhost>
date: Tue Aug 16 12:39:29 2011 +0000
description:
remove gcc-4.5 hack and check fileno instead.
diffstat:
usr.sbin/altq/altqd/Makefile | 7 +------
usr.sbin/altq/altqd/altqd.c | 25 ++++++++++++++++---------
2 files changed, 17 insertions(+), 15 deletions(-)
diffs (86 lines):
diff -r fa66c79d0a36 -r 3bb87de6ee18 usr.sbin/altq/altqd/Makefile
--- a/usr.sbin/altq/altqd/Makefile Tue Aug 16 12:05:52 2011 +0000
+++ b/usr.sbin/altq/altqd/Makefile Tue Aug 16 12:39:29 2011 +0000
@@ -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
diff -r fa66c79d0a36 -r 3bb87de6ee18 usr.sbin/altq/altqd/altqd.c
--- a/usr.sbin/altq/altqd/altqd.c Tue Aug 16 12:05:52 2011 +0000
+++ b/usr.sbin/altq/altqd/altqd.c Tue Aug 16 12:39:29 2011 +0000
@@ -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);
}
}
}
Home |
Main Index |
Thread Index |
Old Index