summaryrefslogtreecommitdiff
path: root/usr.sbin/lpr/lpc
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/lpr/lpc
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/lpr/lpc')
-rw-r--r--usr.sbin/lpr/lpc/cmds.c6
-rw-r--r--usr.sbin/lpr/lpc/lpc.c9
2 files changed, 7 insertions, 8 deletions
diff --git a/usr.sbin/lpr/lpc/cmds.c b/usr.sbin/lpr/lpc/cmds.c
index bd73855b824..d27788c9429 100644
--- a/usr.sbin/lpr/lpc/cmds.c
+++ b/usr.sbin/lpr/lpc/cmds.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmds.c,v 1.26 2013/12/29 14:26:22 krw Exp $ */
+/* $OpenBSD: cmds.c,v 1.27 2015/01/16 06:40:18 deraadt Exp $ */
/* $NetBSD: cmds.c,v 1.12 1997/10/05 15:12:06 mrg Exp $ */
/*
@@ -35,7 +35,6 @@
* lpc -- line printer control program -- commands:
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/file.h>
@@ -45,6 +44,7 @@
#include <errno.h>
#include <dirent.h>
#include <unistd.h>
+#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
@@ -189,7 +189,7 @@ static void
upstat(char *msg)
{
int fd;
- char statfile[MAXPATHLEN];
+ char statfile[PATH_MAX];
if (cgetstr(bp, "st", &ST) == -1)
ST = DEFSTAT;
diff --git a/usr.sbin/lpr/lpc/lpc.c b/usr.sbin/lpr/lpc/lpc.c
index 833a3369479..2661119f60d 100644
--- a/usr.sbin/lpr/lpc/lpc.c
+++ b/usr.sbin/lpr/lpc/lpc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lpc.c,v 1.18 2009/10/27 23:59:52 deraadt Exp $ */
+/* $OpenBSD: lpc.c,v 1.19 2015/01/16 06:40:18 deraadt Exp $ */
/* $NetBSD: lpc.c,v 1.11 2001/11/14 03:01:15 enami Exp $ */
/*
@@ -31,8 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/param.h>
-
#include <dirent.h>
#include <signal.h>
#include <syslog.h>
@@ -41,6 +39,7 @@
#include <stdio.h>
#include <err.h>
#include <errno.h>
+#include <limits.h>
#include <ctype.h>
#include <string.h>
#include <grp.h>
@@ -278,7 +277,7 @@ static int
ingroup(char *grname)
{
static struct group *gptr = NULL;
- static gid_t groups[NGROUPS];
+ static gid_t groups[NGROUPS_MAX];
static int ngroups;
gid_t gid;
int i;
@@ -288,7 +287,7 @@ ingroup(char *grname)
warnx("Warning: unknown group `%s'", grname);
return(0);
}
- if ((ngroups = getgroups(NGROUPS, groups)) < 0)
+ if ((ngroups = getgroups(NGROUPS_MAX, groups)) < 0)
err(1, "getgroups");
}
gid = gptr->gr_gid;