inetd bug
Cathey, Jim
jcathey at ciena.com
Tue Nov 4 18:05:14 UTC 2008
We've been using BB, and found that when we had an /etc/inetd.conf
file with only one service in it, said service being commented in
and out as it was enabled/disabled by the system (along with a HUP
to inetd), that the lone service could not re-enable. I tracked it
down to a bug where the maxsock variable wasn't being used correctly.
(As I recall, we also had some variable typing problems, so I changed
two casts as well. This was with MIPS32.) Enclosed are the patches.
The same problem was in 1.10.2, and 1.11.1 that we're using now.
-- Jim Cathey
diff -Naur obusybox-1.10.2/networking/inetd.c
busybox-1.10.2/networking/inetd.c
--- obusybox-1.10.2/networking/inetd.c 2008-04-18 23:50:27.000000000
-0400
+++ busybox-1.10.2/networking/inetd.c 2008-10-16 11:00:25.000000000
-0400
@@ -341,6 +341,7 @@
#define INIT_G() do { \
rlim_ofile_cur = OPEN_MAX; \
global_queuelen = 128; \
+ maxsock = prev_maxsock = -1; \
config_filename = "/etc/inetd.conf"; \
} while (0)
@@ -459,9 +460,9 @@
{
if (fd >= 0) {
FD_SET(fd, &allsock);
- if (maxsock >= 0 && fd > maxsock) {
+ if (fd > maxsock) {
prev_maxsock = maxsock = fd;
- if ((rlim_t)maxsock > rlim_ofile_cur -
FD_MARGIN)
+ if (maxsock > (int)rlim_ofile_cur - FD_MARGIN)
bump_nofile();
}
}
@@ -476,7 +477,7 @@
fd++;
}
prev_maxsock = maxsock;
- if ((rlim_t)maxsock > rlim_ofile_cur - FD_MARGIN)
+ if (maxsock > (int)rlim_ofile_cur - FD_MARGIN)
bump_nofile();
}
More information about the busybox
mailing list