summaryrefslogtreecommitdiff
path: root/usr.sbin/inetd
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-01-16 06:40:24 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-01-16 06:40:24 +0000
commit315054f4737a39489e0a14f3a92bff61f1592832 (patch)
tree62bf010653374ce09b6beb4dfa0414a91457233b /usr.sbin/inetd
parent79e3d817585ca08a91e30ad14abe43e2ab70295f (diff)
Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
Diffstat (limited to 'usr.sbin/inetd')
-rw-r--r--usr.sbin/inetd/inetd.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c
index d74e11554a3..85661194cc7 100644
--- a/usr.sbin/inetd/inetd.c
+++ b/usr.sbin/inetd/inetd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inetd.c,v 1.142 2014/10/29 03:33:14 dlg Exp $ */
+/* $OpenBSD: inetd.c,v 1.143 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 1983,1991 The Regents of the University of California.
@@ -121,7 +121,6 @@
*
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
@@ -145,6 +144,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <limits.h>
#include <string.h>
#include <login_cap.h>
#include <ifaddrs.h>
@@ -154,6 +154,8 @@
#include <event.h>
#include "pathnames.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
#define TOOMANY 256 /* don't start more than TOOMANY */
#define CNT_INTVL 60 /* servers in CNT_INTVL sec. */
#define RETRYTIME (60*10) /* retry after bind or server fail */
@@ -1428,8 +1430,8 @@ bump_nofile(void)
syslog(LOG_ERR, "getrlimit: %m");
return -1;
}
- rl.rlim_cur = MIN(rl.rlim_max, rl.rlim_cur + FD_CHUNK);
- rl.rlim_cur = MIN(FD_SETSIZE, rl.rlim_cur + FD_CHUNK);
+ rl.rlim_cur = MINIMUM(rl.rlim_max, rl.rlim_cur + FD_CHUNK);
+ rl.rlim_cur = MINIMUM(FD_SETSIZE, rl.rlim_cur + FD_CHUNK);
if (rl.rlim_cur <= rlim_nofile_cur) {
syslog(LOG_ERR,
"bump_nofile: cannot extend file limit, max = %d",