-/* $OpenBSD: cat.c,v 1.20 2009/10/27 23:59:19 deraadt Exp $ */
+/* $OpenBSD: cat.c,v 1.21 2015/01/16 06:39:28 deraadt Exp $ */
/* $NetBSD: cat.c,v 1.11 1995/09/07 06:12:54 jtc Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
#include <string.h>
#include <unistd.h>
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
extern char *__progname;
int bflag, eflag, nflag, sflag, tflag, vflag;
if (buf == NULL) {
if (fstat(wfd, &sbuf))
err(1, "stdout");
- bsize = MAX(sbuf.st_blksize, BUFSIZ);
+ bsize = MAXIMUM(sbuf.st_blksize, BUFSIZ);
if ((buf = malloc(bsize)) == NULL)
err(1, "malloc");
}
-/* $OpenBSD: cp.c,v 1.36 2014/05/21 06:23:02 guenther Exp $ */
+/* $OpenBSD: cp.c,v 1.37 2015/01/16 06:39:31 deraadt Exp $ */
/* $NetBSD: cp.c,v 1.14 1995/09/07 06:14:51 jtc Exp $ */
/*
* in "to") to form the final target path.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "extern.h"
if (*p != '/' && target_mid[-1] != '/')
*target_mid++ = '/';
*target_mid = '\0';
- if (target_mid - to.p_path + nlen >= MAXPATHLEN) {
+ if (target_mid - to.p_path + nlen >= PATH_MAX) {
warnx("%s%s: name too long (not copied)",
to.p_path, p);
rval = 1;
-/* $OpenBSD: extern.h,v 1.13 2012/12/04 02:26:59 deraadt Exp $ */
+/* $OpenBSD: extern.h,v 1.14 2015/01/16 06:39:31 deraadt Exp $ */
/* $NetBSD: extern.h,v 1.3 1995/03/21 09:02:16 cgd Exp $ */
/*-
typedef struct {
char *p_end; /* pointer to NULL at end of path */
char *target_end; /* pointer to end of target base */
- char p_path[MAXPATHLEN]; /* pointer to the start of a path */
+ char p_path[PATH_MAX]; /* pointer to the start of a path */
} PATH_T;
extern PATH_T to;
-/* $OpenBSD: utils.c,v 1.34 2014/04/24 01:34:35 tedu Exp $ */
+/* $OpenBSD: utils.c,v 1.35 2015/01/16 06:39:31 deraadt Exp $ */
/* $NetBSD: utils.c,v 1.6 1997/02/26 14:40:51 cgd Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* for MAXBSIZE */
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "extern.h"
copy_link(FTSENT *p, int exists)
{
int len;
- char link[MAXPATHLEN];
+ char link[PATH_MAX];
if ((len = readlink(p->fts_path, link, sizeof(link)-1)) == -1) {
warn("readlink: %s", p->fts_path);
-/* $OpenBSD: csh.c,v 1.26 2014/10/16 19:43:31 deraadt Exp $ */
+/* $OpenBSD: csh.c,v 1.27 2015/01/16 06:39:31 deraadt Exp $ */
/* $NetBSD: csh.c,v 1.14 1995/04/29 23:21:28 mycroft Exp $ */
/*-
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
-#include <sys/param.h>
#include <fcntl.h>
#include <errno.h>
#include <pwd.h>
#include <string.h>
#include <locale.h>
#include <unistd.h>
+#include <limits.h>
#include <vis.h>
#include <stdarg.h>
*/
set(STRstatus, Strsave(STR0));
- if ((tcp = getenv("HOME")) != NULL && strlen(tcp) < MAXPATHLEN)
+ if ((tcp = getenv("HOME")) != NULL && strlen(tcp) < PATH_MAX)
cp = SAVE(tcp);
else
cp = NULL;
-/* $OpenBSD: dir.c,v 1.17 2014/10/16 19:43:31 deraadt Exp $ */
+/* $OpenBSD: dir.c,v 1.18 2015/01/16 06:39:31 deraadt Exp $ */
/* $NetBSD: dir.c,v 1.9 1995/03/21 09:02:42 cgd Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <stdarg.h>
#include "csh.h"
char *tcp;
Char *cp;
struct directory *dp;
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
static const char emsg[] = "csh: Trying to start from \"%s\"\n";
/* Don't believe the login shell home, because it may be a symlink */
- tcp = getcwd(path, MAXPATHLEN);
+ tcp = getcwd(path, PATH_MAX);
if (tcp == NULL || *tcp == '\0') {
(void) fprintf(csherr, "csh: %s\n", strerror(errno));
if (hp && *hp) {
{
Char *dp;
struct varent *c;
- char ebuf[MAXPATHLEN];
+ char ebuf[PATH_MAX];
int serrno;
cp = globone(cp, G_ERROR);
&& (c = adrof(STRcdpath))) {
Char **cdp;
Char *p;
- Char buf[MAXPATHLEN];
+ Char buf[PATH_MAX];
for (cdp = c->vec; *cdp; cdp++) {
for (dp = buf, p = *cdp; (*dp++ = *p++) != '\0';)
Char *p1, *p2; /* general purpose */
bool slash;
- Char link[MAXPATHLEN];
- char tlink[MAXPATHLEN];
+ Char link[PATH_MAX];
+ char tlink[PATH_MAX];
int cc;
Char *newcp;
* cwd does not start with a path or the result would be too long abort().
*/
if (*cp != '/') {
- Char tmpdir[MAXPATHLEN];
+ Char tmpdir[PATH_MAX];
p1 = value(STRcwd);
if (p1 == NULL || *p1 != '/')
abort();
- if (Strlen(p1) + Strlen(cp) + 1 >= MAXPATHLEN)
+ if (Strlen(p1) + Strlen(cp) + 1 >= PATH_MAX)
abort();
(void) Strlcpy(tmpdir, p1, sizeof tmpdir/sizeof(Char));
(void) Strlcat(tmpdir, STRslash, sizeof tmpdir/sizeof(Char));
-/* $OpenBSD: exec.c,v 1.15 2009/10/27 23:59:21 deraadt Exp $ */
+/* $OpenBSD: exec.c,v 1.16 2015/01/16 06:39:31 deraadt Exp $ */
/* $NetBSD: exec.c,v 1.9 1996/09/30 20:03:54 christos Exp $ */
/*-
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <dirent.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <stdarg.h>
#include "csh.h"
executable(Char *dir, Char *name, bool dir_ok)
{
struct stat stbuf;
- Char path[MAXPATHLEN], *dp, *sp;
+ Char path[PATH_MAX], *dp, *sp;
char *strname;
if (dir && *dir) {
for (dp = path, sp = dir; *sp; *dp++ = *sp++)
- if (dp == &path[MAXPATHLEN]) {
+ if (dp == &path[PATH_MAX]) {
*--dp = '\0';
break;
}
for (sp = name; *sp; *dp++ = *sp++)
- if (dp == &path[MAXPATHLEN]) {
+ if (dp == &path[PATH_MAX]) {
*--dp = '\0';
break;
}
-/* $OpenBSD: file.c,v 1.17 2014/10/16 19:43:31 deraadt Exp $ */
+/* $OpenBSD: file.c,v 1.18 2015/01/16 06:39:31 deraadt Exp $ */
/* $NetBSD: file.c,v 1.11 1996/11/08 19:34:37 christos Exp $ */
/*-
#ifdef FILEC
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <termios.h>
#include <pwd.h>
#include <stdlib.h>
#include <unistd.h>
+#include <limits.h>
#ifndef SHORT_STRINGS
#include <string.h>
#endif /* SHORT_STRINGS */
static Char
filetype(Char *dir, Char *file)
{
- Char path[MAXPATHLEN];
+ Char path[PATH_MAX];
struct stat statb;
Strlcpy(path, dir, sizeof path/sizeof(Char));
static Char person[40];
if (old[0] != '~') {
- Strlcpy(new, old, MAXPATHLEN);
+ Strlcpy(new, old, PATH_MAX);
return new;
}
continue;
*p = '\0';
if (person[0] == '\0')
- (void) Strlcpy(new, value(STRhome), MAXPATHLEN);
+ (void) Strlcpy(new, value(STRhome), PATH_MAX);
else {
pw = getpwnam(short2str(person));
if (pw == NULL)
return (NULL);
- (void) Strlcpy(new, str2short(pw->pw_dir), MAXPATHLEN);
+ (void) Strlcpy(new, str2short(pw->pw_dir), PATH_MAX);
}
- (void) Strlcat(new, o, MAXPATHLEN);
+ (void) Strlcat(new, o, PATH_MAX);
return (new);
}
DIR *dir_fd;
int numitems = 0, ignoring = TRUE, nignored = 0;
int name_length, looking_for_lognames;
- Char tilded_dir[MAXPATHLEN], dir[MAXPATHLEN];
+ Char tilded_dir[PATH_MAX], dir[PATH_MAX];
Char name[MAXNAMLEN + 1], extended_name[MAXNAMLEN + 1];
Char *entry;
Char **items = NULL;
-/* $OpenBSD: glob.c,v 1.14 2014/10/16 19:43:31 deraadt Exp $ */
+/* $OpenBSD: glob.c,v 1.15 2015/01/16 06:39:31 deraadt Exp $ */
/* $NetBSD: glob.c,v 1.10 1995/03/21 09:03:01 cgd Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <glob.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <stdarg.h>
#include "csh.h"
static Char *
globtilde(Char **nv, Char *s)
{
- Char gbuf[MAXPATHLEN], *gstart, *b, *u, *e;
+ Char gbuf[PATH_MAX], *gstart, *b, *u, *e;
gstart = gbuf;
*gstart++ = *s++;
u = s;
- for (b = gstart, e = &gbuf[MAXPATHLEN - 1];
+ for (b = gstart, e = &gbuf[PATH_MAX - 1];
*s && *s != '/' && *s != ':' && b < e;
*b++ = *s++)
continue;
int i, len;
Char *pm, *pe, *lm, *pl;
Char **nv, **vl;
- Char gbuf[MAXPATHLEN];
+ Char gbuf[PATH_MAX];
int size = GLOBSPACE;
nv = vl = xreallocarray(NULL, size, sizeof(Char *));
*pm = EOS;
(void) Strlcpy(lm, pl, &gbuf[sizeof(gbuf)/sizeof(Char)] - lm);
- (void) Strlcat(gbuf, pe + 1, MAXPATHLEN);
+ (void) Strlcat(gbuf, pe + 1, PATH_MAX);
*pm = savec;
*vl++ = Strsave(gbuf);
len++;
dobackp(Char *cp, bool literal)
{
Char *lp, *rp;
- Char *ep, word[MAXPATHLEN];
+ Char *ep, word[PATH_MAX];
if (pargv) {
#ifdef notdef
pargv[0] = NULL;
pargcp = pargs = word;
pargc = 0;
- pnleft = MAXPATHLEN - 4;
+ pnleft = PATH_MAX - 4;
for (;;) {
for (lp = cp; *lp != '`'; lp++) {
if (*lp == 0) {
pargv[pargc++] = Strsave(pargs);
pargv[pargc] = NULL;
pargcp = pargs;
- pnleft = MAXPATHLEN - 4;
+ pnleft = PATH_MAX - 4;
}
int
-/* $OpenBSD: sem.c,v 1.17 2010/08/12 02:00:27 kevlo Exp $ */
+/* $OpenBSD: sem.c,v 1.18 2015/01/16 06:39:31 deraadt Exp $ */
/* $NetBSD: sem.c,v 1.9 1995/09/27 00:38:50 jtc Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <stdarg.h>
#include "csh.h"
return;
if ((flags & F_READ) == 0) {/* F_READ already done */
if (t->t_dlef) {
- char tmp[MAXPATHLEN];
+ char tmp[PATH_MAX];
/*
* so < /dev/std{in,out,err} work
}
}
if (t->t_drit) {
- char tmp[MAXPATHLEN];
+ char tmp[PATH_MAX];
cp = splicepipe(t, t->t_drit);
strlcpy(tmp, short2str(cp), sizeof tmp);
-/* $OpenBSD: conv.c,v 1.11 2009/10/27 23:59:21 deraadt Exp $ */
+/* $OpenBSD: conv.c,v 1.12 2015/01/16 06:39:31 deraadt Exp $ */
/* $NetBSD: conv.c,v 1.6 1996/02/20 19:29:02 jtc Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/time.h>
#include <err.h>
#include "dd.h"
#include "extern.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
/*
* def --
* Copy input to output. Input is buffered until reaches obs, and then
* translation is done as we copy into the output buffer.
*/
for (inp = in.dbp - in.dbcnt, outp = out.dbp; in.dbcnt;) {
- maxlen = MIN(cbsz, in.dbcnt);
+ maxlen = MINIMUM(cbsz, in.dbcnt);
if ((t = ctab) != NULL)
for (cnt = 0;
cnt < maxlen && (ch = *inp++) != '\n'; ++cnt)
-/* $OpenBSD: dd.c,v 1.20 2015/01/05 13:52:47 tedu Exp $ */
+/* $OpenBSD: dd.c,v 1.21 2015/01/16 06:39:31 deraadt Exp $ */
/* $NetBSD: dd.c,v 1.6 1996/02/20 19:29:06 jtc Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/mtio.h>
static void getfdtype(IO *);
static void setup(void);
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
IO in, out; /* input/output state */
STAT st; /* statistics */
void (*cfunc)(void); /* conversion function */
err(1, "input buffer");
out.db = in.db;
} else if ((in.db =
- malloc((u_int)(MAX(in.dbsz, cbsz) + cbsz))) == NULL ||
+ malloc((u_int)(MAXIMUM(in.dbsz, cbsz) + cbsz))) == NULL ||
(out.db = malloc((u_int)(out.dbsz + cbsz))) == NULL)
err(1, "output buffer");
in.dbp = in.db;
-/* $OpenBSD: df.c,v 1.51 2014/05/20 21:11:16 krw Exp $ */
+/* $OpenBSD: df.c,v 1.52 2015/01/16 06:39:31 deraadt Exp $ */
/* $NetBSD: df.c,v 1.21.2.1 1995/11/01 00:06:11 jtc Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/mount.h>
-/* $OpenBSD: ext2fs_df.c,v 1.11 2004/09/14 22:46:04 deraadt Exp $ */
+/* $OpenBSD: ext2fs_df.c,v 1.12 2015/01/16 06:39:31 deraadt Exp $ */
/*
* This file is substantially derived from src/sys/ufs/ext2fs/ext2fs_vfsops.c:e2fs_statfs().
* @(#)ffs_vfsops.c 8.14 (Berkeley) 11/28/94
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/mount.h>
#include <ufs/ext2fs/ext2fs.h>
#include <ufs/ext2fs/ext2fs_dinode.h>
-/* $OpenBSD: ffs_df.c,v 1.14 2014/05/16 13:44:09 krw Exp $ */
+/* $OpenBSD: ffs_df.c,v 1.15 2015/01/16 06:39:31 deraadt Exp $ */
/*
* Copyright (c) 1980, 1990, 1993, 1994
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG */
#include <sys/mount.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
-/* $OpenBSD: domainname.c,v 1.8 2009/10/27 23:59:21 deraadt Exp $ */
+/* $OpenBSD: domainname.c,v 1.9 2015/01/16 06:39:31 deraadt Exp $ */
/* $NetBSD: domainname.c,v 1.7 1995/03/21 09:04:22 cgd Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
-
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
extern char *__progname;
main(int argc, char *argv[])
{
int ch;
- char domainname[MAXHOSTNAMELEN];
+ char domainname[HOST_NAME_MAX+1];
while ((ch = getopt(argc, argv, "")) != -1)
switch (ch) {
-/* $OpenBSD: ed.h,v 1.14 2014/12/02 20:34:14 millert Exp $ */
+/* $OpenBSD: ed.h,v 1.15 2015/01/16 06:39:32 deraadt Exp $ */
/* $NetBSD: ed.h,v 1.23 1995/03/21 09:04:40 cgd Exp $ */
/* ed.h: type and constant definitions for the ed editor. */
*/
#include <sys/types.h>
-#include <sys/param.h> /* for MAXPATHLEN */
#include <errno.h>
#include <limits.h>
#include <regex.h>
/* global vars */
extern int addr_last;
extern int current_addr;
-extern char errmsg[MAXPATHLEN + 40];
+extern char errmsg[PATH_MAX + 40];
extern int first_addr;
extern int lineno;
extern int second_addr;
-/* $OpenBSD: main.c,v 1.42 2014/12/04 08:34:04 daniel Exp $ */
+/* $OpenBSD: main.c,v 1.43 2015/01/16 06:39:32 deraadt Exp $ */
/* $NetBSD: main.c,v 1.3 1995/03/21 09:04:44 cgd Exp $ */
/* main.c: This file contains the main control and user-interface routines
/* if set, signal handlers are enabled */
volatile sig_atomic_t sigactive = 0;
-char old_filename[MAXPATHLEN] = ""; /* default filename */
+char old_filename[PATH_MAX] = ""; /* default filename */
int current_addr; /* current address in editor buffer */
int addr_last; /* last address in editor buffer */
int lineno; /* script line number */
return NULL;
if (n) printf("%s\n", shcmd + 1);
return shcmd;
- } else if (n >= MAXPATHLEN) {
+ } else if (n >= PATH_MAX) {
seterrmsg("filename too long");
return NULL;
}
return NULL;
}
#endif
- REALLOC(file, filesz, MAXPATHLEN, NULL);
+ REALLOC(file, filesz, PATH_MAX, NULL);
for (n = 0; *ibufp != '\n';)
file[n++] = *ibufp++;
file[n] = '\0';
}
-/* strip_escapes: return copy of escaped string of at most length MAXPATHLEN */
+/* strip_escapes: return copy of escaped string of at most length PATH_MAX */
char *
strip_escapes(char *s)
{
int i = 0;
- REALLOC(file, filesz, MAXPATHLEN, NULL);
+ REALLOC(file, filesz, PATH_MAX, NULL);
/* assert: no trailing escape */
while ((file[i++] = (*s == '\\') ? *++s : *s) != '\0' &&
- i < MAXPATHLEN-1)
+ i < PATH_MAX-1)
s++;
- file[MAXPATHLEN-1] = '\0';
+ file[PATH_MAX-1] = '\0';
return file;
}
void
handle_hup(int signo)
{
- char hup[MAXPATHLEN];
+ char hup[PATH_MAX];
if (!sigactive)
quit(1);
-/* $OpenBSD: re.c,v 1.11 2009/10/27 23:59:21 deraadt Exp $ */
+/* $OpenBSD: re.c,v 1.12 2015/01/16 06:39:32 deraadt Exp $ */
/* $NetBSD: re.c,v 1.14 1995/03/21 09:04:48 cgd Exp $ */
/* re.c: This file contains the regular expression interface routines for
extern int patlock;
-char errmsg[MAXPATHLEN + 40] = "";
+char errmsg[PATH_MAX + 40] = "";
/* get_compiled_pattern: return pointer to compiled pattern from command
buffer */
-/* $OpenBSD: hostname.c,v 1.8 2009/10/27 23:59:21 deraadt Exp $ */
+/* $OpenBSD: hostname.c,v 1.9 2015/01/16 06:39:32 deraadt Exp $ */
/* $NetBSD: hostname.c,v 1.10 1995/09/07 06:28:40 jtc Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
-
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
extern char *__progname;
main(int argc, char *argv[])
{
int ch, sflag;
- char *p, hostname[MAXHOSTNAMELEN];
+ char *p, hostname[HOST_NAME_MAX+1];
sflag = 0;
while ((ch = getopt(argc, argv, "s")) != -1)
-/* $OpenBSD: misc.c,v 1.38 2013/11/28 10:33:37 sobrado Exp $ */
+/* $OpenBSD: misc.c,v 1.39 2015/01/16 06:39:32 deraadt Exp $ */
/*
* Miscellaneous functions
#include "sh.h"
#include <ctype.h>
-#include <sys/param.h> /* for MAXPATHLEN */
#include "charclass.h"
short ctypes [UCHAR_MAX+1]; /* type bits for unsigned char */
}
-/* Like getcwd(), except bsize is ignored if buf is 0 (MAXPATHLEN is used) */
+/* Like getcwd(), except bsize is ignored if buf is 0 (PATH_MAX is used) */
char *
ksh_get_wd(char *buf, int bsize)
{
* inject possibly allocated space into the ATEMP area. */
/* Assume getcwd() available */
if (!buf) {
- bsize = MAXPATHLEN;
- b = alloc(MAXPATHLEN + 1, ATEMP);
+ bsize = PATH_MAX;
+ b = alloc(PATH_MAX + 1, ATEMP);
} else
b = buf;
-/* $OpenBSD: ln.c,v 1.21 2014/05/23 04:38:57 guenther Exp $ */
+/* $OpenBSD: ln.c,v 1.22 2015/01/16 06:39:32 deraadt Exp $ */
/* $NetBSD: ln.c,v 1.10 1995/03/21 09:06:10 cgd Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/stat.h>
#include <err.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
int fflag; /* Unlink existing files. */
int hflag; /* Check new name for symlink first. */
linkit(char *target, char *source, int isdir)
{
struct stat sb;
- char *p, path[MAXPATHLEN];
+ char *p, path[PATH_MAX];
int (*statf)(const char *, struct stat *);
int exists, n;
-/* $OpenBSD: print.c,v 1.32 2014/05/06 20:55:10 tedu Exp $ */
+/* $OpenBSD: print.c,v 1.33 2015/01/16 06:39:32 deraadt Exp $ */
/* $NetBSD: print.c,v 1.15 1996/12/11 03:25:39 thorpej Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/stat.h>
#include <err.h>
#include <time.h>
#include <tzfile.h>
#include <unistd.h>
+#include <limits.h>
#include <util.h>
#include "ls.h"
printlink(FTSENT *p)
{
int lnklen;
- char name[MAXPATHLEN], path[MAXPATHLEN];
+ char name[PATH_MAX], path[PATH_MAX];
if (p->fts_level == FTS_ROOTLEVEL)
(void)snprintf(name, sizeof(name), "%s", p->fts_name);
-/* $OpenBSD: md5.c,v 1.77 2014/09/13 16:06:36 doug Exp $ */
+/* $OpenBSD: md5.c,v 1.78 2015/01/16 06:39:32 deraadt Exp $ */
/*
* Copyright (c) 2001,2003,2005-2007,2010,2013,2014
#define MAX_DIGEST_LEN 128
-#define MIN(a,b) (((a)<(b))?(a):(b))
-#define MAX(a,b) (((a)>(b))?(a):(b))
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
union ANY_CTX {
#if !defined(SHA2_ONLY)
algorithm_max = algorithm_min = strlen(functions[0].name);
for (hf = &functions[1]; hf->name != NULL; hf++) {
len = strlen(hf->name);
- algorithm_max = MAX(algorithm_max, len);
- algorithm_min = MIN(algorithm_min, len);
+ algorithm_max = MAXIMUM(algorithm_max, len);
+ algorithm_min = MINIMUM(algorithm_min, len);
}
error = found = 0;
-/* $OpenBSD: mv.c,v 1.37 2014/07/21 19:55:33 deraadt Exp $ */
+/* $OpenBSD: mv.c,v 1.38 2015/01/16 06:39:32 deraadt Exp $ */
/* $NetBSD: mv.c,v 1.9 1995/03/21 09:06:52 cgd Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <pwd.h>
#include <grp.h>
char *p, *endp;
struct stat sb;
int ch;
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
while ((ch = getopt(argc, argv, "if")) != -1)
switch (ch) {
p++;
}
- if ((baselen + (len = strlen(p))) >= MAXPATHLEN) {
+ if ((baselen + (len = strlen(p))) >= PATH_MAX) {
warnx("%s: destination pathname too long", *argv);
rval = 1;
} else {
/* Disallow moving a mount point. */
if (S_ISDIR(fsb.st_mode)) {
struct statfs sfs;
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
if (realpath(from, path) == NULL) {
warnx("cannot resolve %s", from);
-/* $OpenBSD: buf_subs.c,v 1.25 2014/07/14 05:58:19 guenther Exp $ */
+/* $OpenBSD: buf_subs.c,v 1.26 2015/01/16 06:39:32 deraadt Exp $ */
/* $NetBSD: buf_subs.c,v 1.5 1995/03/21 09:07:08 cgd Exp $ */
/*-
*/
if (skcnt == 0)
return(0);
- res = MIN((bufend - bufpt), skcnt);
+ res = MINIMUM((bufend - bufpt), skcnt);
bufpt += res;
skcnt -= res;
return(-1);
if (cnt == 0)
return(1);
- cnt = MIN(cnt, res);
+ cnt = MINIMUM(cnt, res);
bufpt += cnt;
res -= cnt;
}
/*
* only move what we have space for
*/
- cnt = MIN(cnt, outcnt);
+ cnt = MINIMUM(cnt, outcnt);
memcpy(bufpt, out, cnt);
bufpt += cnt;
out += cnt;
* calculate how much data to copy based on whats left and
* state of buffer
*/
- cnt = MIN(cnt, incnt);
+ cnt = MINIMUM(cnt, incnt);
memcpy(in, bufpt, cnt);
bufpt += cnt;
incnt -= cnt;
cnt = bufend - bufpt;
if ((cnt <= 0) && ((cnt = buf_flush(blksz)) < 0))
return(-1);
- cnt = MIN(cnt, skcnt);
+ cnt = MINIMUM(cnt, skcnt);
memset(bufpt, 0, cnt);
bufpt += cnt;
skcnt -= cnt;
*left = size;
return(-1);
}
- cnt = MIN(cnt, size);
+ cnt = MINIMUM(cnt, size);
if ((res = read(ifd, bufpt, cnt)) <= 0)
break;
size -= res;
*/
if ((cnt <= 0) && ((cnt = buf_fill()) <= 0))
break;
- cnt = MIN(cnt, size);
+ cnt = MINIMUM(cnt, size);
if ((res = file_write(ofd,bufpt,cnt,&rem,&isem,sz,fnm)) <= 0) {
*left = size;
break;
-/* $OpenBSD: file_subs.c,v 1.37 2014/11/23 05:32:20 guenther Exp $ */
+/* $OpenBSD: file_subs.c,v 1.38 2015/01/16 06:39:32 deraadt Exp $ */
/* $NetBSD: file_subs.c,v 1.4 1995/03/21 09:07:18 cgd Exp $ */
/*-
* only examine up to the end of the current file block or
* remaining characters to write, whatever is smaller
*/
- wcnt = MIN(cnt, *rem);
+ wcnt = MINIMUM(cnt, *rem);
cnt -= wcnt;
*rem -= wcnt;
if (*isempt) {
-/* $OpenBSD: pax.h,v 1.19 2014/11/23 05:32:20 guenther Exp $ */
+/* $OpenBSD: pax.h,v 1.20 2015/01/16 06:39:32 deraadt Exp $ */
/* $NetBSD: pax.h,v 1.3 1995/03/21 09:07:41 cgd Exp $ */
/*-
/*
* General Macros
*/
-#ifndef MIN
-#define MIN(a,b) (((a)<(b))?(a):(b))
-#endif
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
#define MAJOR(x) major(x)
#define MINOR(x) minor(x)
#define TODEV(x, y) makedev((x), (y))
-/* $OpenBSD: keyword.c,v 1.41 2014/10/13 17:30:21 schwarze Exp $ */
+/* $OpenBSD: keyword.c,v 1.42 2015/01/16 06:39:32 deraadt Exp $ */
/* $NetBSD: keyword.c,v 1.12.6.1 1996/05/30 21:25:13 cgd Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXCOMLEN */
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/proc.h>
/* XXX */
{"ktracep", "KTRACEP", NULL, 0, pvar, PTRWIDTH, 0, POFF(p_tracep), UINT64, "llx"},
{"lim", "LIM", NULL, 0, maxrss, 5},
- {"login", "LOGIN", NULL, LJUST, logname, MAXLOGNAME},
+ {"login", "LOGIN", NULL, LJUST, logname, LOGIN_NAME_MAX},
{"logname", "", "login"},
{"lstart", "STARTED", NULL, LJUST|USER, lstarted, 28},
{"majflt", "MAJFLT", NULL, USER, pvar, 4, 0, POFF(p_uru_majflt), UINT64, "lld"},
-/* $OpenBSD: nlist.c,v 1.18 2011/12/11 00:16:49 nicm Exp $ */
+/* $OpenBSD: nlist.c,v 1.19 2015/01/16 06:39:32 deraadt Exp $ */
/* $NetBSD: nlist.c,v 1.11 1995/03/21 09:08:03 cgd Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXCOMLEN */
#include <sys/time.h>
+#include <sys/signal.h>
#include <sys/proc.h>
#include <sys/resource.h>
#include <sys/sysctl.h>
-/* $OpenBSD: print.c,v 1.58 2014/08/16 16:38:38 tedu Exp $ */
+/* $OpenBSD: print.c,v 1.59 2015/01/16 06:39:32 deraadt Exp $ */
/* $NetBSD: print.c,v 1.27 1995/09/29 21:58:12 cgd Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXCOMLEN PZERO NODEV */
+#include <sys/types.h>
#include <sys/proc.h>
#include <sys/stat.h>
#include <string.h>
#include <tzfile.h>
#include <unistd.h>
+#include <limits.h>
#include <pwd.h>
#include "ps.h"
{
VAR *v;
int name[] = { CTL_KERN, KERN_PROC_CWD, kp->p_pid };
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
size_t pathlen = sizeof path;
if (!kvm_sysctl_only || sysctl(name, 3, path, &pathlen, NULL, 0) != 0)
v = ve->var;
if (kp->p_login[0]) {
- int n = min(v->width, MAXLOGNAME);
+ int n = min(v->width, LOGIN_NAME_MAX);
(void)printf("%-*.*s", n, n, kp->p_login);
if (v->width > n)
(void)printf("%*s", v->width - n, "");
-/* $OpenBSD: ps.c,v 1.62 2014/07/08 23:31:22 deraadt Exp $ */
+/* $OpenBSD: ps.c,v 1.63 2015/01/16 06:39:32 deraadt Exp $ */
/* $NetBSD: ps.c,v 1.15 1995/05/18 20:33:25 mycroft Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXCOMLEN NODEV */
+#include <sys/types.h>
#include <sys/sysctl.h>
#include <sys/time.h>
#include <sys/resource.h>
/* FALLTHROUGH */
case 't': {
struct stat sb;
- char *ttypath, pathbuf[MAXPATHLEN];
+ char *ttypath, pathbuf[PATH_MAX];
if (strcmp(optarg, "co") == 0)
ttypath = _PATH_CONSOLE;
-/* $OpenBSD: rm.c,v 1.29 2014/05/21 06:23:02 guenther Exp $ */
+/* $OpenBSD: rm.c,v 1.30 2015/01/16 06:39:32 deraadt Exp $ */
/* $NetBSD: rm.c,v 1.19 1995/09/07 06:48:50 jtc Exp $ */
/*-
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/param.h>
#include <sys/mount.h>
#include <locale.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <pwd.h>
#include <grp.h>
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
extern char *__progname;
int dflag, eval, fflag, iflag, Pflag, stdin_ok;
}
if (fstatfs(fd, &fsb) == -1)
goto err;
- bsize = MAX(fsb.f_iosize, 1024U);
+ bsize = MAXIMUM(fsb.f_iosize, 1024U);
if ((buf = malloc(bsize)) == NULL)
err(1, "%s: malloc", file);
-/* $OpenBSD: more.c,v 1.34 2013/11/27 20:25:47 deraadt Exp $ */
+/* $OpenBSD: more.c,v 1.35 2015/01/16 06:39:33 deraadt Exp $ */
/*
* Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com>
* o POSIX compliance
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/exec.h>
#include <sys/ioctl.h>
#include <sys/file.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
+#include <limits.h>
#include <paths.h>
#define Fopen(s, m) (Currline = 0, file_pos = 0, fopen(s,m))
-/* $OpenBSD: sysctl.c,v 1.8 2014/05/03 00:27:19 chl Exp $ */
+/* $OpenBSD: sysctl.c,v 1.9 2015/01/16 06:39:34 deraadt Exp $ */
/*
* Copyright (c) 2009 Theo de Raadt <deraadt@openbsd.org>
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+
+#include <sys/types.h>
#include <sys/sysctl.h>
#include <sys/uio.h>
-/* $OpenBSD: comsat.c,v 1.37 2012/12/04 02:24:47 deraadt Exp $ */
+/* $OpenBSD: comsat.c,v 1.38 2015/01/16 06:39:49 deraadt Exp $ */
/*
* Copyright (c) 1980, 1993
#include <errno.h>
#include <fcntl.h>
#include <netdb.h>
+#include <limits.h>
#include <paths.h>
#include <pwd.h>
#include <signal.h>
#define MAXIDLE 120
-char hostname[MAXHOSTNAMELEN];
+char hostname[HOST_NAME_MAX+1];
struct utmp *utmp = NULL;
time_t lastmsgtime;
int nutmp, uf;
FILE *tp;
struct stat stb;
struct termios ttybuf;
- char tty[MAXPATHLEN], name[UT_NAMESIZE + 1];
+ char tty[PATH_MAX], name[UT_NAMESIZE + 1];
(void)snprintf(tty, sizeof(tty), "%s%.*s",
_PATH_DEV, (int)sizeof(utp->ut_line), utp->ut_line);
-/* $OpenBSD: fingerd.c,v 1.36 2012/12/04 02:24:47 deraadt Exp $ */
+/* $OpenBSD: fingerd.c,v 1.37 2015/01/16 06:39:50 deraadt Exp $ */
/*
* Copyright (c) 1983, 1993
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
+#include <limits.h>
#include "pathnames.h"
__dead void logerr(const char *, ...);
#define ENTRIES 50
char **comp, *prog;
char **ap, *av[ENTRIES + 1], line[8192], *lp, *hname;
- char hostbuf[MAXHOSTNAMELEN];
+ char hostbuf[HOST_NAME_MAX+1];
prog = _PATH_FINGER;
logging = secure = user_required = short_list = 0;
-/* $OpenBSD: ftpcmd.y,v 1.56 2014/02/08 13:31:51 millert Exp $ */
+/* $OpenBSD: ftpcmd.y,v 1.57 2015/01/16 06:39:50 deraadt Exp $ */
/* $NetBSD: ftpcmd.y,v 1.7 1996/04/08 19:03:11 jtc Exp $ */
/*
%{
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
-/* $OpenBSD: ftpd.c,v 1.205 2014/10/25 03:19:22 lteo Exp $ */
+/* $OpenBSD: ftpd.c,v 1.206 2015/01/16 06:39:50 deraadt Exp $ */
/* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */
/*
mode_t defumask = CMASK; /* default umask value */
int umaskchange = 1; /* allow user to change umask value. */
char tmpline[7];
-char hostname[MAXHOSTNAMELEN];
-char remotehost[MAXHOSTNAMELEN];
-char dhostname[MAXHOSTNAMELEN];
+char hostname[HOST_NAME_MAX+1];
+char remotehost[HOST_NAME_MAX+1];
+char dhostname[HOST_NAME_MAX+1];
char *guestpw;
char ttyline[20];
#if 0
static char *
curdir(void)
{
- static char path[MAXPATHLEN+1]; /* path + '/' */
+ static char path[PATH_MAX+1]; /* path + '/' */
if (getcwd(path, sizeof(path)-1) == NULL)
return ("");
static int login_attempts; /* number of failed login attempts */
static int askpasswd; /* had user command, ask for passwd */
-static char curname[MAXLOGNAME]; /* current USER name */
+static char curname[LOGIN_NAME_MAX]; /* current USER name */
/*
* USER command.
int authok;
unsigned int flags;
FILE *fp;
- static char homedir[MAXPATHLEN];
- char *motd, *dir, rootdir[MAXPATHLEN];
+ static char homedir[PATH_MAX];
+ char *motd, *dir, rootdir[PATH_MAX];
size_t sz_pw_dir;
if (logged_in || askpasswd == 0) {
/*
* Set home directory so that use of ~ (tilde) works correctly.
*/
- if (getcwd(homedir, MAXPATHLEN) != NULL) {
+ if (getcwd(homedir, PATH_MAX) != NULL) {
if (setenv("HOME", homedir, 1) == -1) {
reply(550, "Can't setup environment.");
goto bad;
(void) fclose(file);
file = getdatasock(mode);
if (file == NULL) {
- char hbuf[MAXHOSTNAMELEN], pbuf[10];
+ char hbuf[HOST_NAME_MAX+1], pbuf[10];
error = getnameinfo((struct sockaddr *)&data_source,
data_source.su_len, hbuf, sizeof(hbuf), pbuf,
{
union sockunion *su;
u_char *a, *p;
- char hbuf[MAXHOSTNAMELEN];
+ char hbuf[HOST_NAME_MAX+1];
int ispassive;
int error;
replydirname(const char *name, const char *message)
{
char *p, *ep;
- char npath[MAXPATHLEN * 2];
+ char npath[PATH_MAX * 2];
p = npath;
ep = &npath[sizeof(npath) - 1];
void
pwd(void)
{
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
if (getcwd(path, sizeof(path)) == NULL)
perror_reply(550, "Can't get current directory");
static int
guniquefd(char *local, char **nam)
{
- static char new[MAXPATHLEN];
+ static char new[PATH_MAX];
struct stat st;
int count, len, fd;
char *cp;
continue;
while ((dir = readdir(dirp)) != NULL) {
- char nbuf[MAXPATHLEN];
+ char nbuf[PATH_MAX];
if (recvurg) {
myoob();
void
logxfer(char *name, off_t size, time_t start)
{
- char buf[400 + MAXHOSTNAMELEN*4 + MAXPATHLEN*4];
- char dir[MAXPATHLEN], path[MAXPATHLEN], rpath[MAXPATHLEN];
- char vremotehost[MAXHOSTNAMELEN*4], vpath[MAXPATHLEN*4];
+ char buf[400 + (HOST_NAME_MAX+1)*4 + PATH_MAX*4];
+ char dir[PATH_MAX], path[PATH_MAX], rpath[PATH_MAX];
+ char vremotehost[(HOST_NAME_MAX+1)*4], vpath[PATH_MAX*4];
char *vpw;
time_t now;
int len;
-/* $OpenBSD: common.h,v 1.4 2012/06/01 01:43:19 dlg Exp $ */
+/* $OpenBSD: common.h,v 1.5 2015/01/16 06:39:50 deraadt Exp $ */
/*-
* Copyright (c) 2001 Hans Insulander <hin@openbsd.org>.
* All rights reserved.
#include <sys/types.h>
#include <sys/resource.h>
-#include <sys/param.h>
#include <signal.h>
#include <syslog.h>
#include <pwd.h>
#include <err.h>
#include <util.h>
+#include <limits.h>
#define MODE_LOGIN 0
-/* $OpenBSD: login.c,v 1.10 2012/06/01 01:43:19 dlg Exp $ */
+/* $OpenBSD: login.c,v 1.11 2015/01/16 06:39:50 deraadt Exp $ */
/*-
* Copyright (c) 1995 Berkeley Software Design, Inc. All rights reserved.
char *username, *password = NULL;
char response[1024];
int arg_login = 0, arg_notickets = 0;
- char invokinguser[MAXLOGNAME];
+ char invokinguser[LOGIN_NAME_MAX];
char *wheel = NULL, *class = NULL;
invokinguser[0] = '\0';
-/* $OpenBSD: raddauth.c,v 1.26 2014/08/10 05:06:38 guenther Exp $ */
+/* $OpenBSD: raddauth.c,v 1.27 2015/01/16 06:39:50 deraadt Exp $ */
/*-
* Copyright (c) 1996, 1997 Berkeley Software Design, Inc. All rights reserved.
in_addr_t
gethost(void)
{
- char hostname[MAXHOSTNAMELEN];
+ char hostname[HOST_NAME_MAX+1];
if (gethostname(hostname, sizeof(hostname)))
err(1, "gethost");
getsecret(void)
{
FILE *servfd;
- char *host, *secret, buffer[MAXPATHLEN];
+ char *host, *secret, buffer[PATH_MAX];
size_t len;
snprintf(buffer, sizeof(buffer), "%s/%s",
-/* $OpenBSD: login_skey.c,v 1.23 2009/06/02 20:42:48 jmeltzer Exp $ */
+/* $OpenBSD: login_skey.c,v 1.24 2015/01/16 06:39:50 deraadt Exp $ */
/*
* Copyright (c) 2000, 2001, 2004 Todd C. Miller <Todd.Miller@courtesan.com>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
+#include <limits.h>
#include <login_cap.h>
#include <bsd_auth.h>
-/* $OpenBSD: login_tis.c,v 1.11 2012/12/04 02:24:47 deraadt Exp $ */
+/* $OpenBSD: login_tis.c,v 1.12 2015/01/16 06:39:50 deraadt Exp $ */
/*
* Copyright (c) 2004 Todd C. Miller <Todd.Miller@courtesan.com>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include <syslog.h>
#include <unistd.h>
-/* $OpenBSD: login_yubikey.c,v 1.9 2014/05/28 12:59:03 otto Exp $ */
+/* $OpenBSD: login_yubikey.c,v 1.10 2015/01/16 06:39:50 deraadt Exp $ */
/*
* Copyright (c) 2010 Daniel Hartmeier <daniel@benzedrine.cx>
*
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
+#include <limits.h>
#include <errno.h>
#include "yubikey.h"
static int
yubikey_login(const char *username, const char *password)
{
- char fn[MAXPATHLEN];
+ char fn[PATH_MAX];
char hexkey[33], key[YUBIKEY_KEY_SIZE];
char hexuid[13], uid[YUBIKEY_UID_SIZE];
FILE *f;
-/* $OpenBSD: locking.c,v 1.11 2014/01/17 21:42:47 tobias Exp $ */
+/* $OpenBSD: locking.c,v 1.12 2015/01/16 06:39:50 deraadt Exp $ */
/*
* Copyright (c) 1996-1998 Theo de Raadt <deraadt@theos.com>
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <pwd.h>
#include <syslog.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include "pathnames.h"
#include "mail.local.h"
-static char lpath[MAXPATHLEN];
+static char lpath[PATH_MAX];
void
rellock(void)
void
baditem(char *path)
{
- char npath[MAXPATHLEN];
+ char npath[PATH_MAX];
int fd;
if (unlink(path) == 0)
-/* $OpenBSD: mail.local.c,v 1.32 2009/10/27 23:59:31 deraadt Exp $ */
+/* $OpenBSD: mail.local.c,v 1.33 2015/01/16 06:39:50 deraadt Exp $ */
/*-
* Copyright (c) 1996-1998 Theo de Raadt <deraadt@theos.com>
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <pwd.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
struct stat sb, fsb;
struct passwd *pw;
int mbfd=-1, rval=1, lfd=-1;
- char biffmsg[100], buf[8*1024], path[MAXPATHLEN];
+ char biffmsg[100], buf[8*1024], path[PATH_MAX];
off_t curoff;
size_t off;
ssize_t nr, nw;
-/* $OpenBSD: rquotad.c,v 1.21 2014/10/08 04:29:16 deraadt Exp $ */
+/* $OpenBSD: rquotad.c,v 1.22 2015/01/16 06:39:50 deraadt Exp $ */
/*
* by Manuel Bouyer (bouyer@ensta.fr). Public domain.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* DEV_BSIZE */
#include <sys/types.h>
#include <sys/mount.h>
#include <sys/socket.h>
-/* $OpenBSD: rstat_proc.c,v 1.32 2014/09/15 19:08:19 miod Exp $ */
+/* $OpenBSD: rstat_proc.c,v 1.33 2015/01/16 06:39:50 deraadt Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
* rstat service: built with rstat.x and derived from rpc.rstatd.c
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/sched.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
-/* $OpenBSD: spamd-setup.c,v 1.42 2015/01/14 11:59:10 millert Exp $ */
+/* $OpenBSD: spamd-setup.c,v 1.43 2015/01/16 06:39:50 deraadt Exp $ */
/*
* Copyright (c) 2003 Bob Beck. All rights reserved.
extern char *__progname;
+#define MAXIMUM(a,b) (((a)>(b))?(a):(b))
+
u_int32_t
imask(u_int8_t b)
{
maxsize = maxblock(start, 32);
diff = maxdiff(start, end);
- maxsize = MAX(maxsize, diff);
+ maxsize = MAXIMUM(maxsize, diff);
if (*cls <= *cli + 1) { /* one extra for terminator */
tmp = reallocarray(list, *cls + 32,
sizeof(struct cidr));
-/* $OpenBSD: spamd.c,v 1.121 2015/01/13 23:22:33 millert Exp $ */
+/* $OpenBSD: spamd.c,v 1.122 2015/01/16 06:39:50 deraadt Exp $ */
/*
* Copyright (c) 2002-2007 Bob Beck. All rights reserved.
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/resource.h>
+#include <sys/signal.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
+#include <limits.h>
#include <netdb.h>
void gethelo(char *, size_t, char *);
int read_configline(FILE *);
-char hostname[MAXHOSTNAMELEN];
+char hostname[HOST_NAME_MAX+1];
struct syslog_data sdata = SYSLOG_DATA_INIT;
char *nreply = "450";
char *spamd = "spamd IP-based SPAM blocker";
int syncsend;
#define MAXTIME 400
+#define MAXIMUM(a,b) (((a)>(b))?(a):(b))
+
void
usage(void)
{
int max, n;
int writers;
- max = MAX(s, conflisten);
+ max = MAXIMUM(s, conflisten);
if (syncrecv)
- max = MAX(max, syncfd);
- max = MAX(max, conffd);
- max = MAX(max, trapfd);
+ max = MAXIMUM(max, syncfd);
+ max = MAXIMUM(max, conffd);
+ max = MAXIMUM(max, trapfd);
time(&t);
for (i = 0; i < maxcon; i++)
if (con[i].fd != -1)
- max = MAX(max, con[i].fd);
+ max = MAXIMUM(max, con[i].fd);
if (max > omax) {
free(fdsr);
-/* $OpenBSD: spamlogd.c,v 1.23 2014/10/25 03:19:22 lteo Exp $ */
+/* $OpenBSD: spamlogd.c,v 1.24 2015/01/16 06:39:50 deraadt Exp $ */
/*
* Copyright (c) 2006 Henning Brauer <henning@openbsd.org>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
+#include <sys/signal.h>
#include <net/if.h>
#include <net/if_pflog.h>
-/* $OpenBSD: announce.c,v 1.22 2013/04/17 17:40:53 deraadt Exp $ */
+/* $OpenBSD: announce.c,v 1.23 2015/01/16 06:39:51 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <errno.h>
#include <syslog.h>
#include <unistd.h>
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int
announce(CTL_MSG *request, char *remote_machine)
{
- char full_tty[MAXPATHLEN];
+ char full_tty[PATH_MAX];
FILE *tf;
struct stat stbuf;
-/* $OpenBSD: process.c,v 1.20 2013/11/27 21:25:24 deraadt Exp $ */
+/* $OpenBSD: process.c,v 1.21 2015/01/16 06:39:51 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
* in the table for the local user
* DELETE - delete invitation
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <string.h>
#include <ctype.h>
#include <paths.h>
+#include <limits.h>
#include "talkd.h"
#define satosin(sa) ((struct sockaddr_in *)(sa))
int status;
FILE *fp;
char line[UT_LINESIZE+1];
- char ftty[MAXPATHLEN];
+ char ftty[PATH_MAX];
time_t idle, now;
time(&now);
-/* $OpenBSD: table.c,v 1.15 2014/10/08 02:10:05 deraadt Exp $ */
+/* $OpenBSD: table.c,v 1.16 2015/01/16 06:39:51 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
*
* Consider this a mis-guided attempt at modularity
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/queue.h>
-/* $OpenBSD: talkd.c,v 1.22 2009/10/27 23:59:31 deraadt Exp $ */
+/* $OpenBSD: talkd.c,v 1.23 2015/01/16 06:39:51 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
* disconnect all descriptors and ttys, and then endless
* loop on waiting for and processing requests
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <protocols/talkd.h>
#include <time.h>
#include <errno.h>
#include <unistd.h>
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void timeout(int);
long lastmsgtime;
-char hostname[MAXHOSTNAMELEN];
+char hostname[HOST_NAME_MAX+1];
#define TIMEOUT 30
#define MAXIDLE 120
-/* $OpenBSD: atactl.c,v 1.44 2011/05/04 21:40:07 oga Exp $ */
+/* $OpenBSD: atactl.c,v 1.45 2015/01/16 06:39:56 deraadt Exp $ */
/* $NetBSD: atactl.c,v 1.4 1999/02/24 18:49:14 jwise Exp $ */
/*-
* atactl(8) - a program to control ATA devices.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* DEV_BSIZE */
#include <sys/ioctl.h>
#include <err.h>
-/* $OpenBSD: badsect.c,v 1.24 2014/05/22 14:38:48 krw Exp $ */
+/* $OpenBSD: badsect.c,v 1.25 2015/01/16 06:39:56 deraadt Exp $ */
/* $NetBSD: badsect.c,v 1.10 1995/03/18 14:54:28 cgd Exp $ */
/*
* this program can be used if the driver for the file system in question
* does not support bad block forwarding.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG MAXBSIZE DEV_BSIZE isclr */
#include <sys/stat.h>
#include <ufs/ffs/fs.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <err.h>
static int chkuse(daddr_t, int);
-/* $OpenBSD: bioctl.c,v 1.122 2014/10/08 10:08:03 jsing Exp $ */
+/* $OpenBSD: bioctl.c,v 1.123 2015/01/16 06:39:56 deraadt Exp $ */
/*
* Copyright (c) 2004, 2005 Marco Peereboom
*
*/
-#include <sys/param.h>
+#include <sys/param.h> /* NODEV */
#include <sys/ioctl.h>
#include <sys/dkio.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <vis.h>
#include <readpassphrase.h>
u_int32_t sz = 0;
int no_dev = 0, i, x;
struct stat sb;
- char dev[MAXPATHLEN];
+ char dev[PATH_MAX];
int fd;
if (!lst)
-/* $OpenBSD: clri.c,v 1.13 2013/04/23 17:29:26 deraadt Exp $ */
+/* $OpenBSD: clri.c,v 1.14 2015/01/16 06:39:56 deraadt Exp $ */
/* $NetBSD: clri.c,v 1.19 2005/01/20 15:50:47 xtraeme Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG MAXBSIZE DEV_BSIZE */
#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
-/* $OpenBSD: dhclient.c,v 1.346 2014/12/10 02:34:03 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.347 2015/01/16 06:39:56 deraadt Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
char *path_dhclient_conf = _PATH_DHCLIENT_CONF;
char *path_dhclient_db = NULL;
-char path_option_db[MAXPATHLEN];
+char path_option_db[PATH_MAX];
int log_perror = 1;
int nullfd = -1;
}
break;
case 'L':
- strlcat(path_option_db, optarg, MAXPATHLEN);
+ strlcat(path_option_db, optarg, PATH_MAX);
if (lstat(path_option_db, &sb) != -1) {
if (!S_ISREG(sb.st_mode))
error("'%s' is not a regular file",
-/* $OpenBSD: dhcpd.h,v 1.146 2014/12/10 02:34:03 krw Exp $ */
+/* $OpenBSD: dhcpd.h,v 1.147 2015/01/16 06:39:56 deraadt Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <signal.h>
#include <syslog.h>
#include <time.h>
#include <unistd.h>
-/* $OpenBSD: privsep.h,v 1.23 2013/12/10 17:02:35 krw Exp $ */
+/* $OpenBSD: privsep.h,v 1.24 2015/01/16 06:39:56 deraadt Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
};
struct imsg_write_file {
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
int rdomain;
int flags;
mode_t mode;
-/* $OpenBSD: disklabel.c,v 1.196 2014/07/20 01:38:40 guenther Exp $ */
+/* $OpenBSD: disklabel.c,v 1.197 2015/01/16 06:39:57 deraadt Exp $ */
/*
* Copyright (c) 1987, 1993
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG DEV_BSIZE */
#include <sys/ioctl.h>
#include <sys/dkio.h>
#include <sys/stat.h>
-/* $OpenBSD: editor.c,v 1.288 2014/10/11 03:08:26 doug Exp $ */
+/* $OpenBSD: editor.c,v 1.289 2015/01/16 06:39:57 deraadt Exp $ */
/*
* Copyright (c) 1997-2000 Todd C. Miller <Todd.Miller@courtesan.com>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <sys/param.h> /* MAXBSIZE DEV_BSIZE MAXFRAG */
#include <sys/types.h>
-#include <sys/param.h>
+#include <sys/signal.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/dkio.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <limits.h>
#include "extern.h"
#include "pathnames.h"
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
/* flags for getuint64() */
#define DO_CONVERSIONS 0x00000001
#define DO_ROUNDING 0x00000002
/* total sectors */
for (;;) {
- u_int64_t nsec = MAX(DL_GETDSIZE(lp),
+ u_int64_t nsec = MAXIMUM(DL_GETDSIZE(lp),
(u_int64_t)lp->d_ncylinders * lp->d_secpercyl);
ui = getuint64(lp, "total sectors",
"The total number of sectors on the disk.",
mpsave(struct disklabel *lp)
{
int i, j;
- char bdev[MAXPATHLEN], *p;
+ char bdev[PATH_MAX], *p;
struct mountinfo mi[MAXPARTITIONS];
FILE *fp;
u_int8_t fstype;
-/* $OpenBSD: dmesg.c,v 1.24 2015/01/13 10:07:58 mpf Exp $ */
+/* $OpenBSD: dmesg.c,v 1.25 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: dmesg.c,v 1.8 1995/03/18 14:54:49 cgd Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/msgbuf.h>
#include <sys/sysctl.h>
-/* $OpenBSD: dumprmt.c,v 1.28 2013/11/22 04:12:47 deraadt Exp $ */
+/* $OpenBSD: dumprmt.c,v 1.29 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: dumprmt.c,v 1.17 1997/06/05 16:10:47 mrg Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXBSIZE */
#include <sys/mtio.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "pathnames.h"
#include "dump.h"
-/* $OpenBSD: itime.c,v 1.18 2014/07/11 16:01:41 halex Exp $ */
+/* $OpenBSD: itime.c,v 1.19 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: itime.c,v 1.4 1997/04/15 01:09:50 lukem Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXBSIZE */
#include <sys/time.h>
#include <ufs/ufs/dinode.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "dump.h"
-/* $OpenBSD: main.c,v 1.52 2014/07/11 16:01:41 halex Exp $ */
+/* $OpenBSD: main.c,v 1.53 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: main.c,v 1.14 1997/06/05 11:13:24 lukem Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG MAXBSIZE DEV_BSIZE roundup */
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include <util.h>
#include "dump.h"
char *
rawname(char *cp)
{
- static char rawbuf[MAXPATHLEN];
+ static char rawbuf[PATH_MAX];
char *dp = strrchr(cp, '/');
if (dp == NULL)
-/* $OpenBSD: optr.c,v 1.34 2013/11/12 04:59:02 deraadt Exp $ */
+/* $OpenBSD: optr.c,v 1.35 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: optr.c,v 1.11 1997/05/27 08:34:36 mrg Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXBSIZE */
#include <sys/wait.h>
#include <sys/time.h>
#include <stdarg.h>
#include <tzfile.h>
#include <unistd.h>
+#include <limits.h>
#include <utmp.h>
#include "dump.h"
-/* $OpenBSD: tape.c,v 1.40 2014/06/13 20:43:06 naddy Exp $ */
+/* $OpenBSD: tape.c,v 1.41 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: tape.c,v 1.11 1997/06/05 11:13:26 lukem Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/types.h>
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG MAXBSIZE DEV_BSIZE */
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include "dump.h"
#include "pathnames.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
int writesize; /* size of malloc()ed buffer for tape */
int64_t lastspclrec = -1; /* tape block number of last written header */
int trecno = 0; /* next record to write in current block */
dblkno = fsbtodb(sblock, blkno);
tpblks = size >> tp_bshift;
- while ((avail = MIN(tpblks, ntrec - trecno)) > 0) {
+ while ((avail = MINIMUM(tpblks, ntrec - trecno)) > 0) {
slp->req[trecno].dblk = dblkno;
slp->req[trecno].count = avail;
trecno += avail;
-/* $OpenBSD: traverse.c,v 1.36 2014/07/10 09:33:43 krw Exp $ */
+/* $OpenBSD: traverse.c,v 1.37 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: traverse.c,v 1.17 1997/06/05 11:13:27 lukem Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG MAXBSIZE DEV_BSIZE dbtob */
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/disklabel.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "dump.h"
int anydirskipped = 0;
if (dirv != NULL) {
- char curdir[MAXPATHLEN];
+ char curdir[PATH_MAX];
FTS *dirh;
FTSENT *entry;
int d;
* Add any parent directories
*/
for (d = 0 ; dirv[d] != NULL ; d++) {
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
if (dirv[d][0] != '/')
(void)snprintf(path, sizeof(path), "%s/%s",
-/* $OpenBSD: dumpfs.c,v 1.30 2014/05/13 12:51:40 krw Exp $ */
+/* $OpenBSD: dumpfs.c,v 1.31 2015/01/16 06:39:57 deraadt Exp $ */
/*
* Copyright (c) 2002 Networks Associates Technology, Inc.
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* DEV_BSIZE MAXFRAG MAXBSIZE isset */
#include <sys/time.h>
#include <ufs/ufs/dinode.h>
#include <unistd.h>
#include <util.h>
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
union {
struct fs fs;
char pad[MAXBSIZE];
max = afs.fs_maxcontig;
size = afs.fs_contigsumsize;
if ((max < 2 && size == 0) ||
- (max > 1 && size >= MIN(max, FS_MAXCONTIG)))
+ (max > 1 && size >= MINIMUM(max, FS_MAXCONTIG)))
i++;
}
}
-/* $OpenBSD: mbr.c,v 1.41 2015/01/03 15:50:50 jsing Exp $ */
+/* $OpenBSD: mbr.c,v 1.42 2015/01/16 06:39:57 deraadt Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/types.h>
+#include <sys/param.h> /* DEV_BSIZE */
#include <sys/fcntl.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
-#include <sys/param.h>
#include <sys/disklabel.h>
#include <sys/dkio.h>
#include <err.h>
-/* $OpenBSD: fsck.c,v 1.32 2014/10/17 06:33:35 deraadt Exp $ */
+/* $OpenBSD: fsck.c,v 1.33 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: fsck.c,v 1.7 1996/10/03 20:06:30 christos Exp $ */
/*
*
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/mount.h>
#include <sys/queue.h>
#include <sys/resource.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <util.h>
#include "pathnames.h"
const char **argv, **edir;
pid_t pid;
int argc, i, status, maxargc;
- char *optbuf = NULL, fsname[MAXPATHLEN], execname[MAXPATHLEN];
+ char *optbuf = NULL, fsname[PATH_MAX], execname[PATH_MAX];
const char *extra = getoptions(vfstype);
if (strcmp(vfstype, "ufs") == 0)
-/* $OpenBSD: fsutil.c,v 1.19 2014/10/08 16:27:53 deraadt Exp $ */
+/* $OpenBSD: fsutil.c,v 1.20 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: fsutil.c,v 1.2 1996/10/03 20:06:31 christos Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <errno.h>
#include <fstab.h>
+#include <limits.h>
#include <err.h>
#include <sys/types.h>
char *
rawname(char *name)
{
- static char rawbuf[MAXPATHLEN];
+ static char rawbuf[PATH_MAX];
char *dp;
if ((dp = strrchr(name, '/')) == NULL)
-/* $OpenBSD: preen.c,v 1.19 2013/11/22 04:14:00 deraadt Exp $ */
+/* $OpenBSD: preen.c,v 1.20 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: preen.c,v 1.15 1996/09/28 19:21:42 christos Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/queue.h>
-/* $OpenBSD: dir.c,v 1.19 2014/07/13 16:08:53 pelikan Exp $ */
+/* $OpenBSD: dir.c,v 1.20 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: dir.c,v 1.5 2000/01/28 16:01:46 bouyer Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* DEV_BSIZE roundup */
#include <sys/time.h>
#include <ufs/ufs/dir.h>
#include <ufs/ext2fs/ext2fs_dinode.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include "fsck.h"
#include "fsutil.h"
fileerror(ino_t cwd, ino_t ino, char *errmesg)
{
struct ext2fs_dinode *dp;
- char pathbuf[MAXPATHLEN + 1];
+ char pathbuf[PATH_MAX + 1];
pwarn("%s ", errmesg);
pinode(ino);
{
struct ext2fs_dinode *dp;
struct inodesc idesc;
- char pathbuf[MAXPATHLEN + 1];
+ char pathbuf[PATH_MAX + 1];
if ((parent < EXT2_FIRSTINO && parent != EXT2_ROOTINO)
|| parent >= maxino ||
-/* $OpenBSD: inode.c,v 1.24 2014/10/29 06:31:58 deraadt Exp $ */
+/* $OpenBSD: inode.c,v 1.25 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: inode.c,v 1.8 2000/01/28 16:01:46 bouyer Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* btodb */
#include <sys/time.h>
#include <ufs/ext2fs/ext2fs_dinode.h>
#include <ufs/ext2fs/ext2fs_dir.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
+#include <limits.h>
#include "fsck.h"
#include "fsutil.h"
struct ext2fs_dinode dino;
u_int64_t remsize, sizepb;
mode_t mode;
- char pathbuf[MAXPATHLEN + 1];
+ char pathbuf[PATH_MAX + 1];
if (idesc->id_fix != IGNORE)
idesc->id_fix = DONTKNOW;
int i, n, (*func)(struct inodesc *), nif;
u_int64_t sizepb;
char buf[BUFSIZ];
- char pathbuf[MAXPATHLEN + 1];
+ char pathbuf[PATH_MAX + 1];
struct ext2fs_dinode *dp;
if (idesc->id_type == ADDR) {
-/* $OpenBSD: main.c,v 1.20 2014/05/21 17:52:26 krw Exp $ */
+/* $OpenBSD: main.c,v 1.21 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: main.c,v 1.1 1997/06/11 11:21:50 bouyer Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/signal.h>
#include <sys/time.h>
#include <sys/mount.h>
#include <ufs/ext2fs/ext2fs_dinode.h>
-/* $OpenBSD: pass1.c,v 1.14 2014/07/13 16:08:53 pelikan Exp $ */
+/* $OpenBSD: pass1.c,v 1.15 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: pass1.c,v 1.9 2000/01/31 11:40:12 bouyer Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* setbit btodb isset */
#include <sys/time.h>
#include <ufs/ext2fs/ext2fs_dinode.h>
#include <ufs/ext2fs/ext2fs_dir.h>
-/* $OpenBSD: pass1b.c,v 1.8 2011/03/12 17:50:47 deraadt Exp $ */
+/* $OpenBSD: pass1b.c,v 1.9 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: pass1b.c,v 1.2 1997/09/14 14:27:26 lukem Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <ufs/ext2fs/ext2fs_dinode.h>
#include <ufs/ext2fs/ext2fs.h>
-/* $OpenBSD: pass2.c,v 1.13 2014/07/13 16:08:53 pelikan Exp $ */
+/* $OpenBSD: pass2.c,v 1.14 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: pass2.c,v 1.6 2000/01/28 16:01:46 bouyer Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* roundup */
#include <sys/time.h>
#include <ufs/ext2fs/ext2fs_dinode.h>
#include <ufs/ext2fs/ext2fs_dir.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include "fsck.h"
#include "fsutil.h"
struct inoinfo **inpend;
struct inodesc curino;
struct ext2fs_dinode dino;
- char pathbuf[MAXPATHLEN + 1];
+ char pathbuf[PATH_MAX + 1];
switch (statemap[EXT2_ROOTINO]) {
struct ext2fs_dinode *dp;
char *errmsg;
struct ext2fs_direct proto;
- char namebuf[MAXPATHLEN + 1];
- char pathbuf[MAXPATHLEN + 1];
+ char namebuf[PATH_MAX + 1];
+ char pathbuf[PATH_MAX + 1];
/*
* check for "."
-/* $OpenBSD: pass3.c,v 1.6 2003/06/11 06:22:13 deraadt Exp $ */
+/* $OpenBSD: pass3.c,v 1.7 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: pass3.c,v 1.2 1997/09/14 14:27:28 lukem Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <ufs/ext2fs/ext2fs_dinode.h>
#include <ufs/ext2fs/ext2fs.h>
-/* $OpenBSD: pass4.c,v 1.9 2013/04/24 13:46:27 deraadt Exp $ */
+/* $OpenBSD: pass4.c,v 1.10 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: pass4.c,v 1.2 1997/09/14 14:27:29 lukem Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* isset clrbit */
#include <sys/time.h>
#include <ufs/ext2fs/ext2fs_dinode.h>
#include <ufs/ext2fs/ext2fs.h>
-/* $OpenBSD: pass5.c,v 1.17 2014/07/13 16:08:53 pelikan Exp $ */
+/* $OpenBSD: pass5.c,v 1.18 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: pass5.c,v 1.7 2000/01/28 16:01:46 bouyer Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* setbit isset */
#include <sys/time.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ext2fs/ext2fs_dinode.h>
-/* $OpenBSD: setup.c,v 1.24 2014/11/20 15:22:39 tedu Exp $ */
+/* $OpenBSD: setup.c,v 1.25 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: setup.c,v 1.1 1997/06/11 11:22:01 bouyer Exp $ */
/*
*/
#define DKTYPENAMES
-#include <sys/param.h>
+#include <sys/param.h> /* DEV_BSIZE roundup */
#include <sys/time.h>
#include <ufs/ext2fs/ext2fs_dinode.h>
#include <ufs/ext2fs/ext2fs.h>
-/* $OpenBSD: utilities.c,v 1.23 2014/07/13 16:08:53 pelikan Exp $ */
+/* $OpenBSD: utilities.c,v 1.24 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: utilities.c,v 1.6 2001/02/04 21:19:34 christos Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* DEV_BSIZE isset setbit */
#include <sys/time.h>
+#include <sys/signal.h>
#include <ufs/ext2fs/ext2fs_dinode.h>
#include <ufs/ext2fs/ext2fs_dir.h>
#include <ufs/ext2fs/ext2fs.h>
-/* $OpenBSD: dir.c,v 1.30 2014/09/06 04:05:40 guenther Exp $ */
+/* $OpenBSD: dir.c,v 1.31 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: dir.c,v 1.20 1996/09/27 22:45:11 christos Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG DEV_BSIZE roundup btodb */
#include <sys/time.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ufs/dir.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include "fsck.h"
#include "fsutil.h"
fileerror(ino_t cwd, ino_t ino, char *errmesg)
{
union dinode *dp;
- char pathbuf[MAXPATHLEN + 1];
+ char pathbuf[PATH_MAX + 1];
pwarn("%s ", errmesg);
pinode(ino);
{
union dinode *dp;
struct inodesc idesc;
- char pathbuf[MAXPATHLEN + 1];
+ char pathbuf[PATH_MAX + 1];
if (parent < ROOTINO || parent >= maxino ||
ino < ROOTINO || ino >= maxino)
-/* $OpenBSD: inode.c,v 1.44 2014/10/08 16:28:38 deraadt Exp $ */
+/* $OpenBSD: inode.c,v 1.45 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: inode.c,v 1.23 1996/10/11 20:15:47 thorpej Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG setbit btodb */
#include <sys/time.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ufs/dir.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "fsck.h"
#include "fsutil.h"
#include "extern.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
static ino_t startinum;
static int iblock(struct inodesc *, long, off_t);
off_t sizepb, remsize;
mode_t mode;
int i;
- char pathbuf[MAXPATHLEN + 1];
+ char pathbuf[PATH_MAX + 1];
if (idesc->id_fix != IGNORE)
idesc->id_fix = DONTKNOW;
int i, n, (*func)(struct inodesc *), nif;
off_t sizepb;
char buf[BUFSIZ];
- char pathbuf[MAXPATHLEN + 1];
+ char pathbuf[PATH_MAX + 1];
union dinode *dp;
if (idesc->id_type == ADDR) {
/* If necessary, extend the inoinfo array. grow exponentially */
if ((ino % sblock.fs_ipg) >= (uint64_t)inostathead[cg].il_numalloced) {
unsigned long newalloced, i;
- newalloced = MIN(sblock.fs_ipg,
- MAX(2 * inostathead[cg].il_numalloced, 10));
+ newalloced = MINIMUM(sblock.fs_ipg,
+ MAXIMUM(2 * inostathead[cg].il_numalloced, 10));
info = calloc(newalloced, sizeof(struct inostat));
if (info == NULL) {
pwarn("cannot alloc %zu bytes to extend inoinfo\n",
-/* $OpenBSD: main.c,v 1.41 2013/11/01 17:36:18 krw Exp $ */
+/* $OpenBSD: main.c,v 1.42 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: main.c,v 1.22 1996/10/11 20:15:48 thorpej Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG */
#include <sys/time.h>
+#include <sys/signal.h>
#include <sys/mount.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
-/* $OpenBSD: pass1.c,v 1.40 2014/10/14 15:01:51 deraadt Exp $ */
+/* $OpenBSD: pass1.c,v 1.41 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: pass1.c,v 1.16 1996/09/27 22:45:15 christos Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG MIN setbit btodb isset */
#include <sys/time.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ufs/dir.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "fsck.h"
#include "extern.h"
-/* $OpenBSD: pass1b.c,v 1.19 2013/06/11 16:42:04 deraadt Exp $ */
+/* $OpenBSD: pass1b.c,v 1.20 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: pass1b.c,v 1.10 1996/09/23 16:18:37 christos Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG */
#include <sys/time.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
-/* $OpenBSD: pass2.c,v 1.35 2014/09/06 04:05:40 guenther Exp $ */
+/* $OpenBSD: pass2.c,v 1.36 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: pass2.c,v 1.17 1996/09/27 22:45:15 christos Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG DEV_BSIZE roundup */
#include <sys/time.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ufs/dir.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include "fsck.h"
#include "fsutil.h"
struct inoinfo **inpend;
struct inodesc curino;
union dinode dino;
- char pathbuf[MAXPATHLEN + 1];
+ char pathbuf[PATH_MAX + 1];
int i;
switch (GET_ISTATE(ROOTINO)) {
union dinode *dp;
char *errmsg;
struct direct proto;
- char namebuf[MAXPATHLEN + 1];
- char pathbuf[MAXPATHLEN + 1];
+ char namebuf[PATH_MAX + 1];
+ char pathbuf[PATH_MAX + 1];
/*
* check for "."
-/* $OpenBSD: pass3.c,v 1.16 2011/05/08 14:38:40 otto Exp $ */
+/* $OpenBSD: pass3.c,v 1.17 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: pass3.c,v 1.8 1995/03/18 14:55:54 cgd Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG */
#include <sys/time.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
-/* $OpenBSD: pass4.c,v 1.22 2013/06/11 16:42:04 deraadt Exp $ */
+/* $OpenBSD: pass4.c,v 1.23 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: pass4.c,v 1.11 1996/09/27 22:45:17 christos Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG isset clrbit */
#include <sys/time.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
-/* $OpenBSD: pass5.c,v 1.46 2014/09/06 04:05:40 guenther Exp $ */
+/* $OpenBSD: pass5.c,v 1.47 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: pass5.c,v 1.16 1996/09/27 22:45:18 christos Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG MAXBSIZE roundup setbit */
#include <sys/time.h>
#include <sys/lock.h>
#include <sys/ucred.h>
#include <ufs/ffs/ffs_extern.h>
#include <stdio.h>
#include <string.h>
+#include <limits.h>
#include "fsutil.h"
#include "fsck.h"
#include "extern.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
static int info_cg;
static int info_maxcg;
if (doit) {
i = fs->fs_contigsumsize;
fs->fs_contigsumsize =
- MIN(fs->fs_maxcontig, FS_MAXCONTIG);
+ MINIMUM(fs->fs_maxcontig, FS_MAXCONTIG);
if (CGSIZE(fs) > fs->fs_bsize) {
pwarn("CANNOT %s CLUSTER MAPS\n", doit);
fs->fs_contigsumsize = i;
-/* $OpenBSD: setup.c,v 1.55 2014/09/06 04:05:40 guenther Exp $ */
+/* $OpenBSD: setup.c,v 1.56 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: setup.c,v 1.27 1996/09/27 22:45:19 christos Exp $ */
/*
* SUCH DAMAGE.
*/
+#include <sys/param.h> /* MAXFRAG MAXBSIZE DEV_BSIZE roundup */
#define DKTYPENAMES
-#include <sys/param.h>
#include <sys/time.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
#include <string.h>
#include <util.h>
#include <unistd.h>
+#include <limits.h>
#include <ctype.h>
#include "fsck.h"
#include "extern.h"
#include "fsutil.h"
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
#define altsblock (*asblk.b_un.b_fs)
#define POWEROF2(num) (((num) & ((num) - 1)) == 0)
static struct disklabel *getdisklabel(char *, int);
static int readsb(int);
static int cmpsb(struct fs *, struct fs *);
-static char rdevname[MAXPATHLEN];
+static char rdevname[PATH_MAX];
long numdirs, listmax, inplast;
(unsigned)sblock.fs_ncg * sizeof(struct inostatlist));
goto badsblabel;
}
- numdirs = MAX(sblock.fs_cstotal.cs_ndir, 128);
+ numdirs = MAXIMUM(sblock.fs_cstotal.cs_ndir, 128);
inplast = 0;
listmax = numdirs + 10;
inpsort = calloc((unsigned)listmax, sizeof(struct inoinfo *));
-/* $OpenBSD: utilities.c,v 1.47 2014/09/06 04:05:40 guenther Exp $ */
+/* $OpenBSD: utilities.c,v 1.48 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: utilities.c,v 1.18 1996/09/27 22:45:20 christos Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG DEV_BSIZE isset setbit clrbit */
#include <sys/time.h>
-#include <sys/types.h>
#include <sys/uio.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ufs/dir.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
+#include <limits.h>
#include <errno.h>
#include <fcntl.h>
#include <paths.h>
memset(&idesc, 0, sizeof(struct inodesc));
idesc.id_type = DATA;
idesc.id_fix = IGNORE;
- cp = &namebuf[MAXPATHLEN - 1];
+ cp = &namebuf[PATH_MAX - 1];
*cp = '\0';
if (curdir != ino) {
idesc.id_parent = curdir;
busy = 0;
if (ino != ROOTINO)
*--cp = '?';
- memcpy(namebuf, cp, (size_t)(&namebuf[MAXPATHLEN] - cp));
+ memcpy(namebuf, cp, (size_t)(&namebuf[PATH_MAX] - cp));
}
/*ARGSUSED*/
-/* $OpenBSD: boot.c,v 1.22 2014/07/10 17:12:05 tobias Exp $ */
+/* $OpenBSD: boot.c,v 1.23 2015/01/16 06:39:58 deraadt Exp $ */
/* $NetBSD: boot.c,v 1.5 1997/10/17 11:19:23 ws Exp $ */
/*
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* DEV_BSIZE powerof2 */
#include <sys/disklabel.h>
#include <stdlib.h>
-/* $OpenBSD: check.c,v 1.16 2014/06/16 18:33:33 tobias Exp $ */
+/* $OpenBSD: check.c,v 1.17 2015/01/16 06:39:58 deraadt Exp $ */
/* $NetBSD: check.c,v 1.8 1997/10/17 11:19:29 ws Exp $ */
/*
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/dkio.h>
#include <sys/disklabel.h>
#include <ctype.h>
#include <stdio.h>
#include <unistd.h>
+#include <limits.h>
#include <fcntl.h>
#include <util.h>
-/* $OpenBSD: dir.c,v 1.27 2014/11/18 20:51:00 krw Exp $ */
+/* $OpenBSD: dir.c,v 1.28 2015/01/16 06:39:58 deraadt Exp $ */
/* $NetBSD: dir.c,v 1.11 1997/10/17 11:19:35 ws Exp $ */
/*
#include <string.h>
#include <ctype.h>
#include <unistd.h>
+#include <limits.h>
#include <time.h>
-#include <sys/param.h>
-
#include "ext.h"
#define SLOT_EMPTY 0x00 /* slot has never been used */
static char *
fullpath(struct dosDirEntry *dir)
{
- static char namebuf[MAXPATHLEN + 1];
+ static char namebuf[PATH_MAX + 1];
char *cp, *np;
int nl;
-/* $OpenBSD: fsdb.c,v 1.27 2013/04/25 06:43:20 otto Exp $ */
+/* $OpenBSD: fsdb.c,v 1.28 2015/01/16 06:39:58 deraadt Exp $ */
/* $NetBSD: fsdb.c,v 1.7 1997/01/11 06:50:53 lukem Exp $ */
/*-
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/types.h>
+#include <sys/param.h> /* MAXFRAG */
#include <sys/stat.h>
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/mount.h>
#include <ctype.h>
-/* $OpenBSD: fsdbutil.c,v 1.15 2013/04/24 13:46:29 deraadt Exp $ */
+/* $OpenBSD: fsdbutil.c,v 1.16 2015/01/16 06:39:58 deraadt Exp $ */
/* $NetBSD: fsdbutil.c,v 1.5 1996/09/28 19:30:37 christos Exp $ */
/*-
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/types.h>
+#include <sys/param.h> /* MAXFRAG */
#include <sys/stat.h>
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/mount.h>
#include <ctype.h>
-/* $OpenBSD: fsirand.c,v 1.30 2014/10/11 03:48:49 deraadt Exp $ */
+/* $OpenBSD: fsirand.c,v 1.31 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/types.h>
+#include <sys/param.h> /* MAXFRAG DEV_BSIZE */
#include <sys/disklabel.h>
#include <sys/ioctl.h>
#include <sys/dkio.h>
-#include <sys/param.h>
#include <sys/resource.h>
#include <sys/time.h>
-/* $OpenBSD: debug.c,v 1.10 2014/05/24 17:56:17 krw Exp $ */
+/* $OpenBSD: debug.c,v 1.11 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2000 Christoph Herrmann, Thomas-Henning von Kamptz
* Copyright (c) 1980, 1989, 1993 The Regents of the University of California.
*/
/* ********************************************************** INCLUDES ***** */
-#include <sys/param.h>
#include <limits.h>
#include <stdio.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
#include "debug.h"
#ifdef FS_DEBUG
ino->di_ctimensec);
remaining_blocks = howmany(ino->di_size, sb->fs_bsize); /* XXX ts - +1? */
- for (ictr = 0; ictr < MIN(NDADDR, remaining_blocks); ictr++) {
+ for (ictr = 0; ictr < MINIMUM(NDADDR, remaining_blocks); ictr++) {
fprintf(dbg_log, "db int32_t[%x] 0x%08x\n", ictr,
ino->di_db[ictr]);
}
/* XXX: What do we do with di_extb[NXADDR]? */
remaining_blocks = howmany(ino->di_size, sb->fs_bsize); /* XXX ts - +1? */
- for (ictr = 0; ictr < MIN(NDADDR, remaining_blocks); ictr++) {
+ for (ictr = 0; ictr < MINIMUM(NDADDR, remaining_blocks); ictr++) {
fprintf(dbg_log, "db daddr_t[%x] 0x%16jx\n", ictr,
ino->di_db[ictr]);
}
size = sizeof(int64_t);
mem = (unsigned int *)block;
- for (i = 0; (size_t)i < MIN(howmany(sb->fs_bsize, size), length); i += 8) {
+ for (i = 0; (size_t)i < MINIMUM(howmany(sb->fs_bsize, size), length); i += 8) {
fprintf(dbg_log, "%04x: ", i);
for (j = 0; j < 8; j++) {
if ((size_t)(i + j) < length) {
-/* $OpenBSD: growfs.c,v 1.36 2014/05/15 19:18:23 chl Exp $ */
+/* $OpenBSD: growfs.c,v 1.37 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2000 Christoph Herrmann, Thomas-Henning von Kamptz
* Copyright (c) 1980, 1989, 1993 The Regents of the University of California.
*/
/* ********************************************************** INCLUDES ***** */
-#include <sys/param.h>
+#include <sys/param.h> /* DEV_BSIZE MAXFRAG MAXBSIZE setbit isset isclr clrbit */
+#include <sys/types.h>
#include <sys/disklabel.h>
#include <sys/ioctl.h>
#include <sys/dkio.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
#include "debug.h"
#define rounddown(x, y) (((x)/(y))*(y))
errx(1, "calloc failed");
for (i = 0; i < osblock.fs_cssize; i += osblock.fs_bsize) {
rdfs(fsbtodb(&osblock, osblock.fs_csaddr +
- numfrags(&osblock, i)), (size_t)MIN(osblock.fs_cssize - i,
+ numfrags(&osblock, i)), (size_t)MINIMUM(osblock.fs_cssize - i,
osblock.fs_bsize), (void *)(((char *)fscs)+i), fsi);
}
*/
for (i = 0; i < sblock.fs_cssize; i += sblock.fs_bsize) {
wtfs(fsbtodb(&sblock, sblock.fs_csaddr + numfrags(&sblock, i)),
- (size_t)MIN(sblock.fs_cssize - i, sblock.fs_bsize),
+ (size_t)MINIMUM(sblock.fs_cssize - i, sblock.fs_bsize),
(void *)(((char *)fscs) + i), fso, Nflag);
}
DBG_PRINT0("fscs written\n");
acg.cg_magic = CG_MAGIC;
acg.cg_cgx = cylno;
acg.cg_ffs2_niblk = sblock.fs_ipg;
- acg.cg_initediblk = MIN(sblock.fs_ipg, 2 * INOPB(&sblock));
+ acg.cg_initediblk = MINIMUM(sblock.fs_ipg, 2 * INOPB(&sblock));
acg.cg_ndblk = dmax - cbase;
if (sblock.fs_contigsumsize > 0)
acg.cg_nclusterblks = acg.cg_ndblk / sblock.fs_frag;
start += sblock.fs_bsize;
dp1 = (struct ufs1_dinode *)&iobuf[start];
dp2 = (struct ufs2_dinode *)&iobuf[start];
- for (i = MIN(sblock.fs_ipg, 2 * INOPB(&sblock)); i != 0; i--) {
+ for (i = MINIMUM(sblock.fs_ipg, 2 * INOPB(&sblock)); i != 0; i--) {
if (sblock.fs_magic == FS_UFS1_MAGIC) {
dp1->di_gen = arc4random();
dp1++;
/*
* Now update all counters.
*/
- cg_clustersum(&acg)[MIN(lcs1 + lcs2 + 1, sblock.fs_contigsumsize)]--;
+ cg_clustersum(&acg)[MINIMUM(lcs1 + lcs2 + 1, sblock.fs_contigsumsize)]--;
if (lcs1)
cg_clustersum(&acg)[lcs1]++;
if (lcs2)
-/* $OpenBSD: ifconfig.c,v 1.294 2015/01/09 20:34:21 sthen Exp $ */
+/* $OpenBSD: ifconfig.c,v 1.295 2015/01/16 06:39:58 deraadt Exp $ */
/* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */
/*
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <util.h>
#include <ifaddrs.h>
#include "brconfig.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
#define HWFEATURESBITS \
"\024\1CSUM_IPv4\2CSUM_TCPv4\3CSUM_UDPv4" \
"\5VLAN_MTU\6VLAN_HWTAGGING\10CSUM_TCPv6" \
if (ifa->ifa_addr->sa_family == AF_INET6) {
memset(&ifr6, 0, sizeof(ifr6));
memcpy(&ifr6.ifr_addr, ifa->ifa_addr,
- MIN(sizeof(ifr6.ifr_addr), ifa->ifa_addr->sa_len));
+ MINIMUM(sizeof(ifr6.ifr_addr), ifa->ifa_addr->sa_len));
ifrp = (struct ifreq *)&ifr6;
} else
#endif
{
memset(&ifr, 0, sizeof(ifr));
memcpy(&ifr.ifr_addr, ifa->ifa_addr,
- MIN(sizeof(ifr.ifr_addr), ifa->ifa_addr->sa_len));
+ MINIMUM(sizeof(ifr.ifr_addr), ifa->ifa_addr->sa_len));
ifrp = 𝔦
}
strlcpy(name, ifa->ifa_name, sizeof(name));
void
settunnel(const char *src, const char *dst)
{
- char buf[MAXHOSTNAMELEN+sizeof (":65535")], *dstport;
+ char buf[HOST_NAME_MAX+1 + sizeof (":65535")], *dstport;
const char *dstip;
struct addrinfo *srcres, *dstres;
int ecode;
struct pflowreq preq;
struct addrinfo hints, *receiver;
int ecode;
- char *ip, *port, buf[MAXHOSTNAMELEN+sizeof (":65535")];
+ char *ip, *port, buf[HOST_NAME_MAX+1 + sizeof (":65535")];
if (strchr (val, ':') == NULL)
errx(1, "%s bad value", val);
{
struct sockaddr_in6 *sin6 = sin6tab[which];
struct addrinfo hints, *res;
- char buf[MAXHOSTNAMELEN+sizeof("/128")], *pfxlen;
+ char buf[HOST_NAME_MAX+1 + sizeof("/128")], *pfxlen;
int error;
memset(&hints, 0, sizeof(hints));
-/* $OpenBSD: ca.c,v 1.32 2014/12/05 07:24:45 mikeb Exp $ */
+/* $OpenBSD: ca.c,v 1.33 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/wait.h>
int ret = -1;
FILE *fp = NULL;
char idstr[IKED_ID_SIZE];
- char file[MAXPATHLEN];
+ char file[PATH_MAX];
struct iked_id idp;
if (len == 0 && data == NULL)
-/* $OpenBSD: config.c,v 1.33 2014/12/03 23:18:21 deraadt Exp $ */
+/* $OpenBSD: config.c,v 1.34 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/wait.h>
#include <sys/socket.h>
-/* $OpenBSD: control.c,v 1.15 2014/06/03 06:25:47 yasuoka Exp $ */
+/* $OpenBSD: control.c,v 1.16 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
*/
#include <sys/queue.h>
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/un.h>
-/* $OpenBSD: crypto.c,v 1.14 2014/07/10 12:50:05 jsg Exp $ */
+/* $OpenBSD: crypto.c,v 1.15 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* roundup */
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/uio.h>
-/* $OpenBSD: dh.c,v 1.15 2014/10/12 15:57:00 jsg Exp $ */
+/* $OpenBSD: dh.c,v 1.16 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2010-2014 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* roundup */
#include <string.h>
#include <openssl/obj_mac.h>
-/* $OpenBSD: eap.c,v 1.10 2014/02/17 11:00:14 reyk Exp $ */
+/* $OpenBSD: eap.c,v 1.11 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/wait.h>
#!/bin/sh
-# $OpenBSD: genmap.sh,v 1.6 2013/01/08 10:38:19 reyk Exp $
+# $OpenBSD: genmap.sh,v 1.7 2015/01/16 06:39:58 deraadt Exp $
# Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
#
sed -n '1,/^ \*\//p' $1
cat <<EOF
-#include <sys/param.h>
#include <sys/types.h>
#include "types.h"
-/* $OpenBSD: iked.c,v 1.22 2014/08/18 09:43:02 reyk Exp $ */
+/* $OpenBSD: iked.c,v 1.23 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/wait.h>
(IKED_OPT_NONATT|IKED_OPT_NATT))
errx(1, "conflicting NAT-T options");
- if (strlcpy(env->sc_conffile, conffile, MAXPATHLEN) >= MAXPATHLEN)
- errx(1, "config file exceeds MAXPATHLEN");
+ if (strlcpy(env->sc_conffile, conffile, PATH_MAX) >= PATH_MAX)
+ errx(1, "config file exceeds PATH_MAX");
ca_sslinit();
policy_init(env);
-/* $OpenBSD: iked.h,v 1.82 2014/08/18 09:43:02 reyk Exp $ */
+/* $OpenBSD: iked.h,v 1.83 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
#include <sys/types.h>
#include <sys/tree.h>
#include <sys/queue.h>
+#include <limits.h>
#include <imsg.h>
#include "types.h"
};
struct iked_user {
- char usr_name[MAXLOGNAME];
+ char usr_name[LOGIN_NAME_MAX];
char usr_pass[IKED_PASSWORD_SIZE];
RB_ENTRY(iked_user) usr_entry;
};
*/
struct iked {
- char sc_conffile[MAXPATHLEN];
+ char sc_conffile[PATH_MAX];
u_int32_t sc_opts;
u_int8_t sc_passive;
-/* $OpenBSD: ikev1.c,v 1.15 2014/04/22 12:00:03 reyk Exp $ */
+/* $OpenBSD: ikev1.c,v 1.16 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
* XXX or remove this file and ikev1 from the iked tree.
*/
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/wait.h>
-/* $OpenBSD: ikev2.c,v 1.117 2014/12/05 13:40:44 mikeb Exp $ */
+/* $OpenBSD: ikev2.c,v 1.118 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* roundup */
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/wait.h>
-/* $OpenBSD: ikev2_msg.c,v 1.37 2014/11/07 14:02:32 mikeb Exp $ */
+/* $OpenBSD: ikev2_msg.c,v 1.38 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* roundup */
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/wait.h>
-/* $OpenBSD: ikev2_pld.c,v 1.46 2014/11/07 14:05:58 mikeb Exp $ */
+/* $OpenBSD: ikev2_pld.c,v 1.47 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/wait.h>
-/* $OpenBSD: log.c,v 1.3 2013/01/08 10:38:19 reyk Exp $ */
+/* $OpenBSD: log.c,v 1.4 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/tree.h>
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/uio.h>
-/* $OpenBSD: parse.y,v 1.43 2015/01/12 11:24:58 mikeb Exp $ */
+/* $OpenBSD: parse.y,v 1.44 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
int
check_pubkey(char *idstr, int type)
{
- char keyfile[MAXPATHLEN];
+ char keyfile[PATH_MAX];
FILE *fp = NULL;
const char *suffix = NULL;
-/* $OpenBSD: pfkey.c,v 1.40 2014/10/29 06:26:39 deraadt Exp $ */
+/* $OpenBSD: pfkey.c,v 1.41 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/uio.h>
#include <sys/socket.h>
-/* $OpenBSD: policy.c,v 1.35 2014/11/07 14:12:57 mikeb Exp $ */
+/* $OpenBSD: policy.c,v 1.36 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/uio.h>
-/* $OpenBSD: proc.c,v 1.21 2014/12/16 03:35:49 millert Exp $ */
+/* $OpenBSD: proc.c,v 1.22 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2010 - 2014 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/wait.h>
-/* $OpenBSD: timer.c,v 1.11 2014/01/24 05:58:52 mikeb Exp $ */
+/* $OpenBSD: timer.c,v 1.12 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/uio.h>
-/* $OpenBSD: util.c,v 1.25 2014/02/21 20:52:38 markus Exp $ */
+/* $OpenBSD: util.c,v 1.26 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
#include <unistd.h>
#include <string.h>
#include <errno.h>
+#include <limits.h>
#include <fcntl.h>
#include <ctype.h>
#include <event.h>
-/* $OpenBSD: init.c,v 1.51 2014/12/06 00:20:22 bluhm Exp $ */
+/* $OpenBSD: init.c,v 1.52 2015/01/16 06:39:58 deraadt Exp $ */
/* $NetBSD: init.c,v 1.22 1996/05/15 23:29:33 jtc Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/sysctl.h>
#include <sys/wait.h>
#include <sys/reboot.h>
pid_t pid, wpid;
int status;
sigset_t mask;
- char shell[MAXPATHLEN]; /* Allocate space here */
- char name[MAXPATHLEN]; /* Name (argv[0]) of shell */
+ char shell[PATH_MAX]; /* Allocate space here */
+ char name[PATH_MAX]; /* Name (argv[0]) of shell */
char *argv[2];
#ifdef SECURE
struct ttyent *typ;
-/* $OpenBSD: ike.c,v 1.78 2013/08/25 23:15:20 mikeb Exp $ */
+/* $OpenBSD: ike.c,v 1.79 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2005 Hans-Joerg Hoexer <hshoexer@openbsd.org>
*
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "ipsecctl.h"
static void
ike_section_ids(struct ipsec_rule *r, FILE *fd)
{
- char myname[MAXHOSTNAMELEN];
+ char myname[HOST_NAME_MAX+1];
if (r->auth == NULL)
return;
-/* $OpenBSD: ipsecctl.c,v 1.78 2014/11/20 14:51:42 krw Exp $ */
+/* $OpenBSD: ipsecctl.c,v 1.79 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2004, 2005 Hans-Joerg Hoexer <hshoexer@openbsd.org>
*
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/queue.h>
-/* $OpenBSD: pfkdump.c,v 1.36 2014/12/28 14:19:31 claudio Exp $ */
+/* $OpenBSD: pfkdump.c,v 1.37 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2003 Markus Friedl. All rights reserved.
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
+
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/sysctl.h>
-/* $OpenBSD: cert.h,v 1.15 2007/08/05 09:43:09 tom Exp $ */
+/* $OpenBSD: cert.h,v 1.16 2015/01/16 06:39:58 deraadt Exp $ */
/* $EOM: cert.h,v 1.8 2000/09/28 12:53:27 niklas Exp $ */
/*
#ifndef _CERT_H_
#define _CERT_H_
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/queue.h>
-/* $OpenBSD: dh.c,v 1.18 2014/10/12 15:57:00 jsg Exp $ */
+/* $OpenBSD: dh.c,v 1.19 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2010-2014 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* roundup */
#include <string.h>
#include <openssl/obj_mac.h>
-/* $OpenBSD: dnssec.c,v 1.23 2005/04/08 22:32:09 cloder Exp $ */
+/* $OpenBSD: dnssec.c,v 1.24 2015/01/16 06:39:58 deraadt Exp $ */
/*
* Copyright (c) 2001 HÃ¥kan Olsson. All rights reserved.
struct exchange *exchange = msg->exchange;
struct rrsetinfo *rr;
struct dns_rdata_key key_rr;
- char name[MAXHOSTNAMELEN];
+ char name[HOST_NAME_MAX+1];
in_addr_t ip4;
u_int8_t algorithm, *id, *umark;
size_t id_len;
-/* $OpenBSD: exchange.h,v 1.33 2007/08/05 09:43:09 tom Exp $ */
+/* $OpenBSD: exchange.h,v 1.34 2015/01/16 06:39:58 deraadt Exp $ */
/* $EOM: exchange.h,v 1.28 2000/09/28 12:54:28 niklas Exp $ */
/*
#ifndef _EXCHANGE_H_
#define _EXCHANGE_H_
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/queue.h>
-/* $OpenBSD: ipsec.c,v 1.142 2015/01/13 04:19:00 deraadt Exp $ */
+/* $OpenBSD: ipsec.c,v 1.143 2015/01/16 06:39:58 deraadt Exp $ */
/* $EOM: ipsec.c,v 1.143 2000/12/11 23:57:42 niklas Exp $ */
/*
extern int acquire_only;
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
/* The replay window size used for all IPsec protocols if not overridden. */
#define DEFAULT_REPLAY_WINDOW 16
case IPSEC_ID_USER_FQDN:
/* String is not NUL terminated, be careful */
id_len -= ISAKMP_ID_DATA_OFF;
- id_len = MIN(id_len, size - 1);
+ id_len = MINIMUM(id_len, size - 1);
memcpy(buf, id + ISAKMP_ID_DATA_OFF, id_len);
buf[id_len] = '\0';
break;
addr_cmp(const void *a, const void *b)
{
const struct contact *x = a, *y = b;
- int minlen = MIN(x->len, y->len);
+ int minlen = MINIMUM(x->len, y->len);
int rv = memcmp(x->addr, y->addr, minlen);
return rv ? rv : (x->len - y->len);
* XXX I think the ASN1 DN case can be thought through to give a better
* estimate.
*/
- size = MAX(sizeof "ipv6/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
+ size = MAXIMUM(sizeof "ipv6/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
sizeof "asn1_dn/" + id_len);
buf = malloc(size);
if (!buf)
-/* $OpenBSD: message.h,v 1.25 2007/04/15 19:37:46 hshoexer Exp $ */
+/* $OpenBSD: message.h,v 1.26 2015/01/16 06:39:59 deraadt Exp $ */
/* $EOM: message.h,v 1.51 2000/10/10 12:36:39 provos Exp $ */
/*
#ifndef _MESSAGE_H_
#define _MESSAGE_H_
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/uio.h>
-/* $OpenBSD: monitor.c,v 1.72 2010/05/10 02:00:50 krw Exp $ */
+/* $OpenBSD: monitor.c,v 1.73 2015/01/16 06:39:59 deraadt Exp $ */
/*
* Copyright (c) 2003 HÃ¥kan Olsson. All rights reserved.
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <regex.h>
#include <keynote.h>
struct monitor_state {
pid_t pid;
int s;
- char root[MAXPATHLEN];
+ char root[PATH_MAX];
} m_state;
extern char *pid_file;
{
size_t len;
int fd, err, cmd;
- char pathreal[MAXPATHLEN];
+ char pathreal[PATH_MAX];
if (path[0] == '/')
strlcpy(pathreal, path, sizeof pathreal);
static void
m_priv_getfd(void)
{
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
size_t len;
int v, flags, ret;
int err = 0;
m_priv_req_readdir()
{
size_t len;
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
DIR *dp;
struct dirent *file;
struct stat sb;
-/* $OpenBSD: sa.h,v 1.50 2013/11/21 22:25:02 yasuoka Exp $ */
+/* $OpenBSD: sa.h,v 1.51 2015/01/16 06:39:59 deraadt Exp $ */
/* $EOM: sa.h,v 1.58 2000/10/10 12:39:01 provos Exp $ */
/*
#ifndef _SA_H_
#define _SA_H_
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/socket.h>
-/* $OpenBSD: timer.h,v 1.7 2004/05/23 18:17:56 hshoexer Exp $ */
+/* $OpenBSD: timer.h,v 1.8 2015/01/16 06:39:59 deraadt Exp $ */
/* $EOM: timer.h,v 1.6 1999/04/11 22:35:55 ho Exp $ */
/*
#ifndef _TIMER_H_
#define _TIMER_H_
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/time.h>
-/* $OpenBSD: transport.h,v 1.18 2006/06/02 19:35:55 hshoexer Exp $ */
+/* $OpenBSD: transport.h,v 1.19 2015/01/16 06:39:59 deraadt Exp $ */
/* $EOM: transport.h,v 1.16 2000/07/17 18:57:59 provos Exp $ */
/*
#ifndef _TRANSPORT_H_
#define _TRANSPORT_H_
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/types.h>
#include <sys/socket.h>
-/* $OpenBSD: x509.c,v 1.117 2014/05/01 07:35:57 jsg Exp $ */
+/* $OpenBSD: x509.c,v 1.118 2015/01/16 06:39:59 deraadt Exp $ */
/* $EOM: x509.c,v 1.54 2001/01/16 18:42:16 ho Exp $ */
/*
* This code was written under funding by Ericsson Radio Systems.
*/
-
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <regex.h>
#include <keynote.h>
-/* $OpenBSD: kbd_wscons.c,v 1.27 2014/03/26 05:22:26 miod Exp $ */
+/* $OpenBSD: kbd_wscons.c,v 1.28 2015/01/16 06:39:59 deraadt Exp $ */
/*
* Copyright (c) 2001 Mats O Jansson. All rights reserved.
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <dev/wscons/wsconsio.h>
{
int kbds[SA_MAX];
int fd, i, kbtype;
- char device[MAXPATHLEN];
+ char device[PATH_MAX];
kvm_t *kd = NULL;
#ifndef NOKVM
char errbuf[LINE_MAX];
-/* $OpenBSD: lmccontrol.c,v 1.10 2013/11/15 22:20:04 millert Exp $ */
+/* $OpenBSD: lmccontrol.c,v 1.11 2015/01/16 06:39:59 deraadt Exp $ */
/*-
* Copyright (c) 1997-1999 LAN Media Corporation (LMC)
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+
+#include <net/if.h>
+#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
-
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-
-#include <net/if.h>
-#include <netinet/in.h>
+#include <limits.h>
typedef struct lmc___ctl lmc_ctl_t;
#include <dev/pci/if_lmcioctl.h>
-/* $OpenBSD: getmntopts.c,v 1.11 2009/10/27 23:59:33 deraadt Exp $ */
+/* $OpenBSD: getmntopts.c,v 1.12 2015/01/16 06:39:59 deraadt Exp $ */
/* $NetBSD: getmntopts.c,v 1.3 1995/03/18 14:56:58 cgd Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/mount.h>
#include <err.h>
#include <fstab.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include "mntopts.h"
-/* $OpenBSD: mount.c,v 1.59 2014/09/08 01:47:05 guenther Exp $ */
+/* $OpenBSD: mount.c,v 1.60 2015/01/16 06:39:59 deraadt Exp $ */
/* $NetBSD: mount.c,v 1.24 1995/11/18 03:34:29 cgd Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/mount.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <util.h>
#include "pathnames.h"
FILE *mountdfp;
pid_t pid;
int all, ch, forceall, i, mntsize, rval, new;
- char *options, mntpath[MAXPATHLEN];
+ char *options, mntpath[PATH_MAX];
all = forceall = 0;
options = NULL;
struct statfs sf;
pid_t pid;
int argc, i, status, argvsize;
- char *optbuf, execname[MAXPATHLEN], mntpath[MAXPATHLEN];
+ char *optbuf, execname[PATH_MAX], mntpath[PATH_MAX];
if (realpath(name, mntpath) == NULL) {
warn("realpath %s", name);
-/* $OpenBSD: mount_cd9660.c,v 1.20 2011/06/27 19:48:27 tedu Exp $ */
+/* $OpenBSD: mount_cd9660.c,v 1.21 2015/01/16 06:39:59 deraadt Exp $ */
/* $NetBSD: mount_cd9660.c,v 1.3 1996/04/13 01:31:08 jtc Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#define CD9660
#include <sys/mount.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "mntopts.h"
{
struct iso_args args;
int ch, mntflags, opts, sess = 0;
- char *dev, dir[MAXPATHLEN];
+ char *dev, dir[PATH_MAX];
const char *errstr;
mntflags = opts = 0;
-/* $OpenBSD: mount_ext2fs.c,v 1.16 2012/07/09 12:58:01 krw Exp $ */
+/* $OpenBSD: mount_ext2fs.c,v 1.17 2015/01/16 06:39:59 deraadt Exp $ */
/* $NetBSD: mount_ffs.c,v 1.3 1996/04/13 01:31:19 jtc Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/mount.h>
#include <err.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "mntopts.h"
{
struct ufs_args args; /* XXX ffs_args */
int ch, mntflags;
- char fs_name[MAXPATHLEN], *errcause;
+ char fs_name[PATH_MAX], *errcause;
mntflags = 0;
optind = optreset = 1; /* Reset for parse of new argv. */
-/* $OpenBSD: mount_ffs.c,v 1.20 2009/10/27 23:59:33 deraadt Exp $ */
+/* $OpenBSD: mount_ffs.c,v 1.21 2015/01/16 06:39:59 deraadt Exp $ */
/* $NetBSD: mount_ffs.c,v 1.3 1996/04/13 01:31:19 jtc Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/mount.h>
#include <err.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "mntopts.h"
{
struct ufs_args args; /* XXX ffs_args */
int ch, mntflags;
- char fs_name[MAXPATHLEN], *errcause;
+ char fs_name[PATH_MAX], *errcause;
mntflags = 0;
optind = optreset = 1; /* Reset for parse of new argv. */
-/* $OpenBSD: mount_msdos.c,v 1.28 2013/11/22 04:12:48 deraadt Exp $ */
+/* $OpenBSD: mount_msdos.c,v 1.29 2015/01/16 06:39:59 deraadt Exp $ */
/* $NetBSD: mount_msdos.c,v 1.16 1996/10/24 00:12:50 cgd Exp $ */
/*
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <errno.h>
#include "mntopts.h"
struct msdosfs_args args;
struct stat sb;
int c, mntflags, set_gid, set_uid, set_mask;
- char *dev, dir[MAXPATHLEN];
+ char *dev, dir[PATH_MAX];
char *errcause;
mntflags = set_gid = set_uid = set_mask = 0;
-/* $OpenBSD: mount_nfs.c,v 1.51 2014/05/21 06:23:01 guenther Exp $ */
+/* $OpenBSD: mount_nfs.c,v 1.52 2015/01/16 06:39:59 deraadt Exp $ */
/* $NetBSD: mount_nfs.c,v 1.12.4.1 1996/05/25 22:48:05 fvdl Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/mount.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "mntopts.h"
struct nfs_args *nfsargsp;
struct nfs_args nfsargs;
int mntflags, num;
- char name[MAXPATHLEN], *options = NULL, *spec;
+ char name[PATH_MAX], *options = NULL, *spec;
const char *p;
union mntval value;
-/* $OpenBSD: mount_ntfs.c,v 1.14 2011/06/27 23:40:07 tedu Exp $ */
+/* $OpenBSD: mount_ntfs.c,v 1.15 2015/01/16 06:39:59 deraadt Exp $ */
/* $NetBSD: mount_ntfs.c,v 1.9 2003/05/03 15:37:08 christos Exp $ */
/*
* Id: mount_ntfs.c,v 1.1.1.1 1999/02/03 03:51:19 semenu Exp
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <string.h>
#include <sysexits.h>
#include <unistd.h>
+#include <limits.h>
#include <mntopts.h>
struct ntfs_args args;
struct stat sb;
int c, mntflags, set_gid, set_uid, set_mask;
- char *dev, dir[MAXPATHLEN];
+ char *dev, dir[PATH_MAX];
mntflags = set_gid = set_uid = set_mask = 0;
memset(&args, 0, sizeof(args));
-/* $OpenBSD: mount_tmpfs.c,v 1.4 2014/01/21 21:58:27 jsg Exp $ */
+/* $OpenBSD: mount_tmpfs.c,v 1.5 2015/01/16 06:39:59 deraadt Exp $ */
/* $NetBSD: mount_tmpfs.c,v 1.24 2008/08/05 20:57:45 pooka Exp $ */
/*
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-#if 0
-__RCSID("$NetBSD: mount_tmpfs.c,v 1.24 2008/08/05 20:57:45 pooka Exp $");
-#endif
-
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <util.h>
#include "mount_tmpfs.h"
if (argc != 2)
usage();
- strlcpy(canon_dev, argv[0], MAXPATHLEN);
+ strlcpy(canon_dev, argv[0], PATH_MAX);
pathadj(argv[1], canon_dir);
if (stat(canon_dir, &sb) == -1)
mount_tmpfs(int argc, char *argv[])
{
struct tmpfs_args args;
- char canon_dev[MAXPATHLEN], canon_dir[MAXPATHLEN];
+ char canon_dev[PATH_MAX], canon_dir[PATH_MAX];
int mntflags;
mount_tmpfs_parseargs(argc, argv, &args, &mntflags,
if (realpath(input, adjusted) == NULL)
warn("Warning: realpath %s", input);
- if (strncmp(input, adjusted, MAXPATHLEN)) {
+ if (strncmp(input, adjusted, PATH_MAX)) {
warnx("\"%s\" is a non-resolved or relative path.", input);
warnx("using \"%s\" instead.", adjusted);
}
-/* $OpenBSD: mount_udf.c,v 1.6 2013/11/12 04:59:02 deraadt Exp $ */
+/* $OpenBSD: mount_udf.c,v 1.7 2015/01/16 06:39:59 deraadt Exp $ */
/*
* Copyright (c) 2005 Pedro Martelletto <pedro@ambientworks.net>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/mount.h>
#include <sys/ioctl.h>
#include <sys/cdio.h>
#include <err.h>
#include <fcntl.h>
#include <unistd.h>
+#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
main(int argc, char **argv)
{
struct udf_args args;
- char node[MAXPATHLEN];
+ char node[PATH_MAX];
int ch, flags = 0;
while ((ch = getopt(argc, argv, "o:")) != -1)
-/* $OpenBSD: mount_vnd.c,v 1.16 2014/10/29 21:30:10 tedu Exp $ */
+/* $OpenBSD: mount_vnd.c,v 1.17 2015/01/16 06:39:59 deraadt Exp $ */
/*
* Copyright (c) 1993 University of Utah.
* Copyright (c) 1990, 1993
* @(#)vnconfig.c 8.1 (Berkeley) 12/15/93
*/
-#include <sys/param.h>
+#include <sys/param.h> /* DEV_BSIZE */
#include <sys/ioctl.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <util.h>
#define DEFAULT_VND "vnd0"
-/* $OpenBSD: mountd.c,v 1.78 2014/11/20 15:22:39 tedu Exp $ */
+/* $OpenBSD: mountd.c,v 1.79 2015/01/16 06:39:59 deraadt Exp $ */
/* $NetBSD: mountd.c,v 1.31 1996/02/18 11:57:53 fvdl Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/mount.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "pathnames.h"
#include <stdarg.h>
struct exportlist *exphead;
struct mountlist *mlhead;
struct grouplist *grphead;
-char exname[MAXPATHLEN];
+char exname[PATH_MAX];
struct xucred def_anon = {
.cr_uid = (uid_t) -2,
.cr_gid = (gid_t) -2,
void
mntsrv(struct svc_req *rqstp, SVCXPRT *transp)
{
- char rpcpath[RPCMNT_PATHLEN+1], dirpath[MAXPATHLEN];
+ char rpcpath[RPCMNT_PATHLEN+1], dirpath[PATH_MAX];
struct hostent *hp = NULL;
struct exportlist *ep;
sigset_t sighup_mask;
void
parsecred(char *namelist, struct xucred *cr)
{
- gid_t groups[NGROUPS + 1];
+ gid_t groups[NGROUPS_MAX + 1];
char *name, *names;
struct passwd *pw;
struct group *gr;
return;
}
cr->cr_uid = pw->pw_uid;
- ngroups = NGROUPS + 1;
+ ngroups = NGROUPS_MAX + 1;
if (getgrouplist(pw->pw_name, pw->pw_gid, groups, &ngroups))
syslog(LOG_ERR, "Too many groups for %s: %m", pw->pw_name);
/*
return;
}
cr->cr_ngroups = 0;
- while (names != NULL && *names != '\0' && cr->cr_ngroups < NGROUPS) {
+ while (names != NULL && *names != '\0' && cr->cr_ngroups < NGROUPS_MAX) {
name = strsep(&names, ":");
if (isdigit((unsigned char)*name) || *name == '-') {
cr->cr_groups[cr->cr_ngroups++] = atoi(name);
cr->cr_groups[cr->cr_ngroups++] = gr->gr_gid;
}
}
- if (names != NULL && *names != '\0' && cr->cr_ngroups == NGROUPS)
+ if (names != NULL && *names != '\0' && cr->cr_ngroups == NGROUPS_MAX)
syslog(LOG_ERR, "Too many groups");
}
-/* $OpenBSD: ncheck_ffs.c,v 1.47 2014/10/09 02:41:22 deraadt Exp $ */
+/* $OpenBSD: ncheck_ffs.c,v 1.48 2015/01/16 06:39:59 deraadt Exp $ */
/*-
* Copyright (c) 1995, 1996 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG MAXBSIZE DEV_BSIZE */
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
+#include <limits.h>
#include <fstab.h>
#include <errno.h>
#include <err.h>
char *
rawname(char *name)
{
- static char newname[MAXPATHLEN];
+ static char newname[PATH_MAX];
char *p;
if ((p = strrchr(name, '/')) == NULL)
-/* $OpenBSD: mkfs.c,v 1.86 2014/06/30 19:19:17 otto Exp $ */
+/* $OpenBSD: mkfs.c,v 1.87 2015/01/16 06:40:00 deraadt Exp $ */
/* $NetBSD: mkfs.c,v 1.25 1995/06/18 21:35:38 cgd Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG MAXBSIZE DEV_BSIZE roundup btodb setbit */
+#include <sys/signal.h>
#include <sys/time.h>
#include <sys/disklabel.h>
#include <sys/ioctl.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
+#include <limits.h>
#ifndef STANDALONE
#include <a.out.h>
#include <errno.h>
#endif
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
/*
* Default directory umask.
*/
*/
origdensity = density;
for (;;) {
- fragsperinode = MAX(numfrags(&sblock, density), 1);
+ fragsperinode = MAXIMUM(numfrags(&sblock, density), 1);
minfpg = fragsperinode * INOPB(&sblock);
if (minfpg > sblock.fs_size)
acg.cg_magic = CG_MAGIC;
acg.cg_cgx = cylno;
acg.cg_ffs2_niblk = sblock.fs_ipg;
- acg.cg_initediblk = MIN(sblock.fs_ipg, 2 * INOPB(&sblock));
+ acg.cg_initediblk = MINIMUM(sblock.fs_ipg, 2 * INOPB(&sblock));
acg.cg_ndblk = dmax - cbase;
start = sizeof(struct cg);
start += sblock.fs_bsize;
dp1 = (struct ufs1_dinode *)(&iobuf[start]);
dp2 = (struct ufs2_dinode *)(&iobuf[start]);
- for (i = MIN(sblock.fs_ipg, 2 * INOPB(&sblock)); i != 0; i--) {
+ for (i = MINIMUM(sblock.fs_ipg, 2 * INOPB(&sblock)); i != 0; i--) {
if (sblock.fs_magic == FS_UFS1_MAGIC) {
dp1->di_gen = (u_int32_t)arc4random();
dp1++;
err(1, "can't get physmem");
if (getrlimit(RLIMIT_DATA, &datasz) != 0)
err(1, "can't get rlimit");
- bound = MIN(datasz.rlim_max, bound);
+ bound = MINIMUM(datasz.rlim_max, bound);
allocate = 0;
maxino = sblock.fs_ncg * (unsigned long long)sblock.fs_ipg;
allocate += roundup(howmany(maxfsblock, NBBY), sizeof(int16_t));
allocate += (maxino + 1) * 3;
allocate += sblock.fs_ncg * sizeof(long);
- allocate += (MAX(ndir, 128) + 10) * sizeof(struct inoinfo);
- allocate += MAX(ndir, 128) * sizeof(struct inoinfo);
+ allocate += (MAXIMUM(ndir, 128) + 10) * sizeof(struct inoinfo);
+ allocate += MAXIMUM(ndir, 128) * sizeof(struct inoinfo);
if (allocate > bound)
warnx("warning: fsck_ffs will need %lluMB; "
-/* $OpenBSD: newfs.c,v 1.97 2014/07/20 01:38:40 guenther Exp $ */
+/* $OpenBSD: newfs.c,v 1.98 2015/01/16 06:40:00 deraadt Exp $ */
/* $NetBSD: newfs.c,v 1.20 1996/05/16 07:13:03 thorpej Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG DEV_BSIZE MAXBSIZE */
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
+#include <limits.h>
#include <signal.h>
#include <util.h>
#include "mntopts.h"
#include "pathnames.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
struct mntopt mopts[] = {
MOPT_STDOPTS,
MOPT_ASYNC,
char *cp = NULL, *s1, *s2, *special, *opstring, *realdev;
#ifdef MFS
char mountfromname[BUFSIZ];
- char *pop = NULL, node[MAXPATHLEN];
+ char *pop = NULL, node[PATH_MAX];
pid_t pid, res;
struct statfs sf;
struct stat mountpoint;
special = argv[0];
if (!mfs) {
- char execname[MAXPATHLEN], name[MAXPATHLEN];
+ char execname[PATH_MAX], name[PATH_MAX];
if (fstype == NULL)
fstype = readlabelfs(special, 0);
if (fsize == 0) {
fsize = DISKLABELV1_FFS_FSIZE(pp->p_fragblock);
if (fsize <= 0)
- fsize = MAX(DFL_FRAGSIZE, lp->d_secsize);
+ fsize = MAXIMUM(DFL_FRAGSIZE, lp->d_secsize);
}
if (bsize == 0) {
bsize = DISKLABELV1_FFS_BSIZE(pp->p_fragblock);
if (bsize <= 0)
- bsize = MIN(DFL_BLKSIZE, 8 * fsize);
+ bsize = MINIMUM(DFL_BLKSIZE, 8 * fsize);
}
if (density == 0)
density = NFPI * fsize;
-/* $OpenBSD: mke2fs.c,v 1.12 2014/09/27 06:28:45 doug Exp $ */
+/* $OpenBSD: mke2fs.c,v 1.13 2015/01/16 06:40:00 deraadt Exp $ */
/* $NetBSD: mke2fs.c,v 1.13 2009/10/19 18:41:08 bouyer Exp $ */
/*-
* in the Linux kernel distribution
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXBSIZE powerof2 roundup setbit isset MIN */
+#include <sys/types.h>
#include <sys/mman.h>
#include <sys/time.h>
#include <ufs/ext2fs/ext2fs_dinode.h>
-/* $OpenBSD: newfs_ext2fs.c,v 1.14 2014/11/20 15:22:39 tedu Exp $ */
+/* $OpenBSD: newfs_ext2fs.c,v 1.15 2015/01/16 06:40:00 deraadt Exp $ */
/* $NetBSD: newfs_ext2fs.c,v 1.8 2009/03/02 10:38:13 tsutsui Exp $ */
/*
/*
* newfs: friendly front end to mke2fs
*/
-#include <sys/param.h>
+#include <sys/param.h> /* powerof2 */
+#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/dkio.h>
#include <sys/disklabel.h>
#include <unistd.h>
#include <util.h>
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
#include "extern.h"
static int64_t strsuftoi64(const char *, const char *, int64_t, int64_t, int *);
char *volname = NULL; /* volume name */
static char *disktype = NULL;
-static char device[MAXPATHLEN];
+static char device[PATH_MAX];
struct disklabel *getdisklabel(const char *, int);
struct partition *getpartition(int, const char *, char *[], struct disklabel **);
"size %" PRId64 " bytes, in %d byte chunks.\n",
special, bufrem, bufsize);
while (bufrem > 0) {
- i = write(fso, buf, MIN(bufsize, bufrem));
+ i = write(fso, buf, MINIMUM(bufsize, bufrem));
if (i == -1)
err(1, "writing image");
bufrem -= i;
-/* $OpenBSD: newfs_msdos.c,v 1.24 2014/07/10 20:09:53 tobias Exp $ */
+/* $OpenBSD: newfs_msdos.c,v 1.25 2015/01/16 06:40:00 deraadt Exp $ */
/*
* Copyright (c) 1998 Robert Nordier
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* powerof2 */
#include <sys/stat.h>
#include <sys/disklabel.h>
#include <sys/ioctl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <util.h>
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
#define MAXU16 0xffff /* maximum unsigned 16-bit quantity */
#define BPN 4 /* bits per nibble */
#define NPB 2 /* nibbles per byte */
static u_int opt_s, opt_u;
static int opt_N;
static int Iflag, mflag, oflag;
- char buf[MAXPATHLEN];
+ char buf[PATH_MAX];
struct stat sb;
struct timeval tv;
struct bpb bpb;
x = bpb.bkbs + 1;
}
if (!bpb.res)
- bpb.res = fat == 32 ? MAX(x, MAX(16384 / bpb.bps, 4)) : x;
+ bpb.res = fat == 32 ? MAXIMUM(x, MAXIMUM(16384 / bpb.bps, 4)) : x;
else if (bpb.res < x)
errx(1, "too few reserved sectors");
if (fat != 32 && !bpb.rde)
x1 += x * bpb.nft;
x = (u_int64_t)(bpb.bsec - x1) * bpb.bps * NPB /
(bpb.spc * bpb.bps * NPB + fat / BPN * bpb.nft);
- x2 = howmany((RESFTE + MIN(x, maxcls(fat))) * (fat / BPN),
+ x2 = howmany((RESFTE + MINIMUM(x, maxcls(fat))) * (fat / BPN),
bpb.bps * NPB);
if (!bpb.bspf) {
bpb.bspf = x2;
-/* $OpenBSD: nfsd.c,v 1.34 2014/05/11 00:03:14 chl Exp $ */
+/* $OpenBSD: nfsd.c,v 1.35 2015/01/16 06:40:00 deraadt Exp $ */
/* $NetBSD: nfsd.c,v 1.19 1996/02/18 23:18:56 mycroft Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/wait.h>
-/* $OpenBSD: parse.y,v 1.643 2014/12/19 13:04:07 reyk Exp $ */
+/* $OpenBSD: parse.y,v 1.644 2015/01/16 06:40:00 deraadt Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
struct loadanchors *loadanchor;
if (strlen(pf->anchor->name) + 1 +
- strlen($3) >= MAXPATHLEN) {
+ strlen($3) >= PATH_MAX) {
yyerror("anchorname %s too long, max %u\n",
- $3, MAXPATHLEN - 1);
+ $3, PATH_MAX - 1);
free($3);
YYERROR;
}
loadanchor = calloc(1, sizeof(struct loadanchors));
if (loadanchor == NULL)
err(1, "loadrule: calloc");
- if ((loadanchor->anchorname = malloc(MAXPATHLEN)) ==
+ if ((loadanchor->anchorname = malloc(PATH_MAX)) ==
NULL)
err(1, "loadrule: malloc");
if (pf->anchor->name[0])
- snprintf(loadanchor->anchorname, MAXPATHLEN,
+ snprintf(loadanchor->anchorname, PATH_MAX,
"%s/%s", pf->anchor->name, $3);
else
- strlcpy(loadanchor->anchorname, $3, MAXPATHLEN);
+ strlcpy(loadanchor->anchorname, $3, PATH_MAX);
if ((loadanchor->filename = strdup($5)) == NULL)
err(1, "loadrule: strdup");
-/* $OpenBSD: pfctl.c,v 1.328 2014/12/10 13:59:29 bluhm Exp $ */
+/* $OpenBSD: pfctl.c,v 1.329 2015/01/16 06:40:00 deraadt Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
memset(&pr, 0, sizeof(pr));
if (anchorname[0] == '/') {
- if ((npath = calloc(1, MAXPATHLEN)) == NULL)
+ if ((npath = calloc(1, PATH_MAX)) == NULL)
errx(1, "pfctl_rules: calloc");
- strlcpy(npath, anchorname, MAXPATHLEN);
+ strlcpy(npath, anchorname, PATH_MAX);
} else {
if (path[0])
- snprintf(&path[len], MAXPATHLEN - len, "/%s", anchorname);
+ snprintf(&path[len], PATH_MAX - len, "/%s", anchorname);
else
- snprintf(&path[len], MAXPATHLEN - len, "%s", anchorname);
+ snprintf(&path[len], PATH_MAX - len, "%s", anchorname);
npath = path;
}
pf->anchor = rs->anchor;
if (path[0])
- snprintf(&path[len], MAXPATHLEN - len, "/%s", pf->anchor->name);
+ snprintf(&path[len], PATH_MAX - len, "/%s", pf->anchor->name);
else
- snprintf(&path[len], MAXPATHLEN - len, "%s", pf->anchor->name);
+ snprintf(&path[len], PATH_MAX - len, "%s", pf->anchor->name);
if (depth) {
if (TAILQ_FIRST(rs->rules.active.ptr) != NULL) {
if (r->anchor) {
if (r->anchor->match) {
if (path[0])
- snprintf(&path[len], MAXPATHLEN - len,
+ snprintf(&path[len], PATH_MAX - len,
"/%s", r->anchor->name);
else
- snprintf(&path[len], MAXPATHLEN - len,
+ snprintf(&path[len], PATH_MAX - len,
"%s", r->anchor->name);
name = r->anchor->name;
} else
memset(&pf, 0, sizeof(pf));
memset(&trs, 0, sizeof(trs));
- if ((path = calloc(1, MAXPATHLEN)) == NULL)
+ if ((path = calloc(1, PATH_MAX)) == NULL)
ERRX("pfctl_rules: calloc");
if (strlcpy(trs.pfrt_anchor, anchorname,
sizeof(trs.pfrt_anchor)) >= sizeof(trs.pfrt_anchor))
}
mnr = pr.nr;
for (nr = 0; nr < mnr; ++nr) {
- char sub[MAXPATHLEN];
+ char sub[PATH_MAX];
pr.nr = nr;
if (ioctl(dev, DIOCGETRULESET, &pr))
int opts = 0;
int optimize = PF_OPTIMIZE_BASIC;
int level;
- char anchorname[MAXPATHLEN];
+ char anchorname[PATH_MAX];
int anchor_wildcard = 0;
char *path;
char *lfile = NULL, *sfile = NULL;
/* NOTREACHED */
}
- if ((path = calloc(1, MAXPATHLEN)) == NULL)
+ if ((path = calloc(1, PATH_MAX)) == NULL)
errx(1, "pfctl: calloc");
memset(anchorname, 0, sizeof(anchorname));
if (anchoropt != NULL) {
-/* $OpenBSD: pfctl_osfp.c,v 1.20 2014/10/25 03:18:13 lteo Exp $ */
+/* $OpenBSD: pfctl_osfp.c,v 1.21 2015/01/16 06:40:00 deraadt Exp $ */
/*
* Copyright (c) 2003 Mike Frantzen <frantzen@openbsd.org>
#include "pfctl_parser.h"
#include "pfctl.h"
-#ifndef MIN
-# define MIN(a,b) (((a) < (b)) ? (a) : (b))
-#endif /* MIN */
-#ifndef MAX
-# define MAX(a,b) (((a) > (b)) ? (a) : (b))
-#endif /* MAX */
-
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
#if 0
# define DEBUG(fp, str, v...) \
nm_class = fingerprint_name_entry(&classes, fp->fp_os.fp_class_nm);
if (nm_class->nm_num == 0) {
nm_class->nm_num = class;
- class_count = MAX(class_count, class);
+ class_count = MAXIMUM(class_count, class);
}
nm_version = fingerprint_name_entry(&nm_class->nm_sublist,
if (nm_version) {
if (nm_version->nm_num == 0) {
nm_version->nm_num = version;
- nm_class->nm_sublist_num = MAX(nm_class->nm_sublist_num,
+ nm_class->nm_sublist_num = MAXIMUM(nm_class->nm_sublist_num,
version);
}
nm_subtype = fingerprint_name_entry(&nm_version->nm_sublist,
if (nm_subtype->nm_num == 0) {
nm_subtype->nm_num = subtype;
nm_version->nm_sublist_num =
- MAX(nm_version->nm_sublist_num, subtype);
+ MAXIMUM(nm_version->nm_sublist_num, subtype);
}
}
}
-/* $OpenBSD: pfctl_parser.c,v 1.300 2014/10/27 21:51:32 mikeb Exp $ */
+/* $OpenBSD: pfctl_parser.c,v 1.301 2015/01/16 06:40:00 deraadt Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
#include <err.h>
#include <ifaddrs.h>
#include <unistd.h>
+#include <limits.h>
#define SYSLOG_NAMES
#include <syslog.h>
-/* $OpenBSD: pfctl_table.c,v 1.72 2013/07/05 13:07:57 blambert Exp $ */
+/* $OpenBSD: pfctl_table.c,v 1.73 2015/01/16 06:40:00 deraadt Exp $ */
/*
* Copyright (c) 2002 Cedric Berger
#include <stdlib.h>
#include <string.h>
#include <time.h>
+#include <limits.h>
#include "pfctl_parser.h"
#include "pfctl.h"
-/* $OpenBSD: ping.c,v 1.113 2014/11/20 15:22:39 tedu Exp $ */
+/* $OpenBSD: ping.c,v 1.114 2015/01/16 06:40:00 deraadt Exp $ */
/* $NetBSD: ping.c,v 1.20 1995/08/11 22:37:58 cgd Exp $ */
/*
#include <errno.h>
#include <poll.h>
#include <string.h>
+#include <limits.h>
#include <stdlib.h>
struct tv32 {
struct in_addr saddr;
int ch, i, optval = 1, packlen, preload, maxsize, df = 0, tos = 0;
u_char *datap, *packet, ttl = MAXTTL, loop = 1;
- char *target, hnamebuf[MAXHOSTNAMELEN];
+ char *target, hnamebuf[HOST_NAME_MAX+1];
char rspace[3 + 4 * NROUTES + 1]; /* record route space */
socklen_t maxsizelen;
const char *errstr;
{
struct hostent *hp;
struct in_addr in;
- static char buf[16+3+MAXHOSTNAMELEN];
+ static char buf[16+3+HOST_NAME_MAX+1];
in.s_addr = a;
if ((options & F_NUMERIC) ||
-/* $OpenBSD: ping6.c,v 1.100 2014/12/03 23:04:52 deraadt Exp $ */
+/* $OpenBSD: ping6.c,v 1.101 2015/01/16 06:40:00 deraadt Exp $ */
/* $KAME: ping6.c,v 1.163 2002/10/25 02:19:06 itojun Exp $ */
/*
return buf;
}
+#define MINIMUM(a,b) (((a)<(b))?(a):(b))
+
/*
* pr_pack --
* Print out the packet, if it came from us. This logic is necessary
(void)printf(" (%d bytes %s)",
abs(delta), delta > 0 ? "extra" : "short");
- end = buf + MIN(cc, ICMP6ECHOLEN + datalen);
+ end = buf + MINIMUM(cc, ICMP6ECHOLEN + datalen);
}
for (i = 8; cp < end; ++i, ++cp, ++dp) {
if (*cp != *dp) {
-/* $OpenBSD: quotacheck.c,v 1.34 2014/07/22 18:28:40 jca Exp $ */
+/* $OpenBSD: quotacheck.c,v 1.35 2015/01/16 06:40:00 deraadt Exp $ */
/* $NetBSD: quotacheck.c,v 1.12 1996/03/30 22:34:25 mark Exp $ */
/*
/*
* Fix up / report on disk quotas & usage
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG DEV_BSIZE MAXBSIZE */
#include <sys/stat.h>
#include <sys/wait.h>
#include <grp.h>
#include <errno.h>
#include <unistd.h>
+#include <limits.h>
#include <util.h>
#include <stdio.h>
#include <stdlib.h>
struct quotaname {
long flags;
- char grpqfname[MAXPATHLEN + 1];
- char usrqfname[MAXPATHLEN + 1];
+ char grpqfname[PATH_MAX + 1];
+ char usrqfname[PATH_MAX + 1];
};
#define HASUSR 1
#define HASGRP 2
-/* $OpenBSD: reboot.c,v 1.33 2013/02/09 21:21:27 millert Exp $ */
+/* $OpenBSD: reboot.c,v 1.34 2015/01/16 06:40:00 deraadt Exp $ */
/* $NetBSD: reboot.c,v 1.8 1995/10/05 05:36:22 mycroft Exp $ */
/*
#include <sys/types.h>
#include <sys/reboot.h>
#include <sys/fcntl.h>
-#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/wait.h>
#include <machine/cpu.h>
-/* $OpenBSD: dirs.c,v 1.38 2014/09/07 19:43:35 guenther Exp $ */
+/* $OpenBSD: dirs.c,v 1.39 2015/01/16 06:40:00 deraadt Exp $ */
/* $NetBSD: dirs.c,v 1.26 1997/07/01 05:37:49 lukem Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG */
#include <sys/stat.h>
#include <sys/time.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "restore.h"
#include "extern.h"
static long seekpt;
static FILE *df, *mf;
static RST_DIR *dirp;
-static char dirfile[MAXPATHLEN] = "#"; /* No file */
-static char modefile[MAXPATHLEN] = "#"; /* No file */
+static char dirfile[PATH_MAX] = "#"; /* No file */
+static char modefile[PATH_MAX] = "#"; /* No file */
static char dot[2] = "."; /* So it can be modified */
/*
struct direct *dp;
size_t namelen;
long bpt;
- char locname[MAXPATHLEN + 1];
+ char locname[PATH_MAX + 1];
itp = inotablookup(ino);
if (itp == NULL) {
{
ino_t ino;
struct direct *dp;
- char *path, *name, buffer[MAXPATHLEN];
+ char *path, *name, buffer[PATH_MAX];
strlcpy(buffer, pathname, sizeof buffer);
path = buffer;
-/* $OpenBSD: interactive.c,v 1.28 2013/04/25 06:43:20 otto Exp $ */
+/* $OpenBSD: interactive.c,v 1.29 2015/01/16 06:40:00 deraadt Exp $ */
/* $NetBSD: interactive.c,v 1.10 1997/03/19 08:42:52 lukem Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG */
#include <sys/time.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "restore.h"
#include "extern.h"
struct entry *np;
ino_t ino;
struct arglist arglist;
- char curdir[MAXPATHLEN];
- char name[MAXPATHLEN];
+ char curdir[PATH_MAX];
+ char name[PATH_MAX];
char cmd[BUFSIZ];
arglist.freeglob = 0;
* If no argument, use curdir as the default.
*/
if (*cp == '\0') {
- (void)strlcpy(name, curdir, MAXPATHLEN);
+ (void)strlcpy(name, curdir, PATH_MAX);
return;
}
nextarg = cp;
retnext:
strlcpy(name, ap->glob.gl_pathv[ap->glob.gl_pathc - ap->argcnt],
- MAXPATHLEN);
+ PATH_MAX);
if (--ap->argcnt == 0) {
ap->freeglob = 0;
globfree(&ap->glob);
RST_DIR *dirp;
size_t namelen;
int entries, len;
- char locname[MAXPATHLEN];
+ char locname[PATH_MAX];
dp = pathsearch(name);
if (dp == NULL || (!dflag && TSTINO(dp->d_ino, dumpmap) == 0))
strcmp(dp->d_name, "..") == 0))
continue;
locname[namelen] = '\0';
- if (namelen + dp->d_namlen >= MAXPATHLEN) {
+ if (namelen + dp->d_namlen >= PATH_MAX) {
fprintf(stderr, "%s%s: name exceeds %d char\n",
- locname, dp->d_name, MAXPATHLEN);
+ locname, dp->d_name, PATH_MAX);
} else {
(void)strncat(locname, dp->d_name,
(int)dp->d_namlen);
-/* $OpenBSD: main.c,v 1.21 2014/11/26 18:34:51 millert Exp $ */
+/* $OpenBSD: main.c,v 1.22 2015/01/16 06:40:00 deraadt Exp $ */
/* $NetBSD: main.c,v 1.13 1997/07/01 05:37:51 lukem Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG */
#include <sys/stat.h>
#include <sys/time.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "restore.h"
#include "extern.h"
ino_t ino;
char *inputdev;
char *symtbl = "./restoresymtable";
- char *p, name[MAXPATHLEN];
+ char *p, name[PATH_MAX];
/* Temp files should *not* be readable. We set permissions later. */
(void)umask(077);
-/* $OpenBSD: symtab.c,v 1.21 2013/12/30 22:01:23 deraadt Exp $ */
+/* $OpenBSD: symtab.c,v 1.22 2015/01/16 06:40:00 deraadt Exp $ */
/* $NetBSD: symtab.c,v 1.10 1997/03/19 08:42:54 lukem Exp $ */
/*
* are needed, by calling "myname".
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <ufs/ufs/dinode.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "restore.h"
#include "extern.h"
{
struct entry *ep;
char *np, *cp;
- char buf[MAXPATHLEN];
+ char buf[PATH_MAX];
cp = name;
for (ep = lookupino(ROOTINO); ep != NULL; ep = ep->e_entries) {
myname(struct entry *ep)
{
char *cp;
- static char namebuf[MAXPATHLEN];
+ static char namebuf[PATH_MAX];
- for (cp = &namebuf[MAXPATHLEN - 2]; cp > &namebuf[ep->e_namlen]; ) {
+ for (cp = &namebuf[PATH_MAX - 2]; cp > &namebuf[ep->e_namlen]; ) {
cp -= ep->e_namlen;
memcpy(cp, ep->e_name, ep->e_namlen);
if (ep == lookupino(ROOTINO))
-/* $OpenBSD: tape.c,v 1.44 2014/09/07 19:43:35 guenther Exp $ */
+/* $OpenBSD: tape.c,v 1.45 2015/01/16 06:40:00 deraadt Exp $ */
/* $NetBSD: tape.c,v 1.26 1997/04/15 07:12:25 lukem Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXBSIZE */
#include <sys/ioctl.h>
#include <sys/mtio.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "restore.h"
#include "extern.h"
static int ofile;
static char *map;
-static char lnkbuf[MAXPATHLEN + 1];
+static char lnkbuf[PATH_MAX + 1];
static size_t pathlen;
int oldinofmt; /* old inode format conversion required */
{
pathlen += size;
- if (pathlen > MAXPATHLEN)
+ if (pathlen > PATH_MAX)
errx(1, "symbolic link name: %s->%s%s; too long %lu",
curfile.name, lnkbuf, buf, (u_long)pathlen);
(void)strlcat(lnkbuf, buf, sizeof(lnkbuf));
-/* $OpenBSD: utilities.c,v 1.17 2013/04/24 13:46:29 deraadt Exp $ */
+/* $OpenBSD: utilities.c,v 1.18 2015/01/16 06:40:00 deraadt Exp $ */
/* $NetBSD: utilities.c,v 1.11 1997/03/19 08:42:56 lukem Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <ufs/ufs/dinode.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "restore.h"
#include "extern.h"
void
mktempname(struct entry *ep)
{
- char oldname[MAXPATHLEN];
+ char oldname[PATH_MAX];
if (ep->e_flags & TMPNAME)
badentry(ep, "mktempname: called with TMPNAME");
char *
gentempname(struct entry *ep)
{
- static char name[MAXPATHLEN];
+ static char name[PATH_MAX];
struct entry *np;
long i = 0;
-/* $OpenBSD: route.c,v 1.170 2014/08/19 12:39:36 mpi Exp $ */
+/* $OpenBSD: route.c,v 1.171 2015/01/16 06:40:00 deraadt Exp $ */
/* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/sysctl.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
+#include <limits.h>
#include <stdio.h>
#include <ctype.h>
#include <stddef.h>
-/* $OpenBSD: show.c,v 1.96 2014/05/08 09:28:08 mpi Exp $ */
+/* $OpenBSD: show.c,v 1.97 2015/01/16 06:40:00 deraadt Exp $ */
/* $NetBSD: show.c,v 1.1 1996/11/15 18:01:41 gwr Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "show.h"
}
}
-static char line[MAXHOSTNAMELEN];
-static char domain[MAXHOSTNAMELEN];
+static char line[HOST_NAME_MAX+1];
+static char domain[HOST_NAME_MAX+1];
void
p_sockaddr_mpls(struct sockaddr *in, struct sockaddr *out, int flags, int width)
-/* $OpenBSD: savecore.c,v 1.49 2013/06/03 02:49:42 tedu Exp $ */
+/* $OpenBSD: savecore.c,v 1.50 2015/01/16 06:40:00 deraadt Exp $ */
/* $NetBSD: savecore.c,v 1.26 1996/03/18 21:16:05 leo Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* NODEV DEV_BSIZE */
#include <sys/stat.h>
#include <sys/mount.h>
#include <sys/syslog.h>
#include <kvm.h>
#include <vis.h>
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
extern FILE *zopen(const char *fname, const char *mode, int bits);
#define KREAD(kd, addr, p)\
{
FILE *fp;
int bounds, ifd, nr, nw, ofd = -1;
- char *rawp, path[MAXPATHLEN];
+ char *rawp, path[PATH_MAX];
mode_t um;
um = umask(S_IRWXG|S_IRWXO);
for (; dumpsize != 0; dumpsize -= nr) {
(void)printf("%8luK\r", dumpsize / 1024);
(void)fflush(stdout);
- nr = read(ifd, buf, MIN(dumpsize, sizeof(buf)));
+ nr = read(ifd, buf, MINIMUM(dumpsize, sizeof(buf)));
if (nr <= 0) {
if (nr == 0)
syslog(LOG_WARNING,
DIR *dfd;
struct dirent *dir;
struct stat sb;
- char *dp, devname[MAXPATHLEN];
+ char *dp, devname[PATH_MAX];
if ((dfd = opendir(_PATH_DEV)) == NULL) {
syslog(LOG_ERR, "%s: %s", _PATH_DEV, strerror(errno));
char *
rawname(char *s)
{
- char *sl, name[MAXPATHLEN];
+ char *sl, name[PATH_MAX];
if ((sl = strrchr(s, '/')) == NULL || sl[1] == '0') {
syslog(LOG_ERR,
off_t minfree, spacefree, kernelsize, needed;
struct stat st;
struct statfs fsbuf;
- char buf[100], path[MAXPATHLEN];
+ char buf[100], path[PATH_MAX];
int fd;
tkernel = kernel ? kernel : _PATH_UNIX;
-/* $OpenBSD: scan_ffs.c,v 1.17 2013/11/01 17:36:19 krw Exp $ */
+/* $OpenBSD: scan_ffs.c,v 1.18 2015/01/16 06:40:00 deraadt Exp $ */
/*
* Copyright (c) 1998 Niklas Hallqvist, Tobias Weingartner
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/param.h> /* MAXFRAG */
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/fcntl.h>
#include <ufs/ffs/fs.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
+#include <limits.h>
#include <err.h>
#include <util.h>
-/* $OpenBSD: shutdown.c,v 1.37 2013/11/22 04:12:48 deraadt Exp $ */
+/* $OpenBSD: shutdown.c,v 1.38 2015/01/16 06:40:01 deraadt Exp $ */
/* $NetBSD: shutdown.c,v 1.9 1995/03/18 15:01:09 cgd Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/resource.h>
#include <sys/syslog.h>
#include <sys/types.h>
#include <time.h>
#include <tzfile.h>
#include <unistd.h>
+#include <limits.h>
#include <errno.h>
#include <err.h>
void
timewarn(int timeleft)
{
- static char hostname[MAXHOSTNAMELEN];
- char wcmd[MAXPATHLEN + 4];
+ static char hostname[HOST_NAME_MAX+1];
+ char wcmd[PATH_MAX + 4];
extern char **environ;
static int first;
FILE *pf;
-/* $OpenBSD: swapctl.c,v 1.18 2010/12/29 12:14:41 stsp Exp $ */
+/* $OpenBSD: swapctl.c,v 1.19 2015/01/16 06:40:01 deraadt Exp $ */
/* $NetBSD: swapctl.c,v 1.9 1998/07/26 20:23:15 mycroft Exp $ */
/*
* <dev> add this device
*/
-#include <sys/param.h>
#include <sys/stat.h>
-
#include <sys/swap.h>
#include <unistd.h>
-/* $OpenBSD: swaplist.c,v 1.9 2014/08/10 05:00:25 guenther Exp $ */
+/* $OpenBSD: swaplist.c,v 1.10 2015/01/16 06:40:01 deraadt Exp $ */
/* $NetBSD: swaplist.c,v 1.8 1998/10/08 10:00:31 mrg Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* dbtob */
+#include <sys/types.h>
#include <sys/swap.h>
#include <err.h>
-/* $OpenBSD: sysctl.c,v 1.207 2014/11/19 18:04:54 tedu Exp $ */
+/* $OpenBSD: sysctl.c,v 1.208 2015/01/16 06:40:01 deraadt Exp $ */
/* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/gmon.h>
#include <sys/mount.h>
#include <sys/sem.h>
-/* $OpenBSD: tunefs.c,v 1.34 2014/05/20 21:11:16 krw Exp $ */
+/* $OpenBSD: tunefs.c,v 1.35 2015/01/16 06:40:01 deraadt Exp $ */
/* $NetBSD: tunefs.c,v 1.33 2005/01/19 20:46:16 xtraeme Exp $ */
/*
/*
* tunefs: change layout parameters to an existing file system.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* DEV_BSIZE MAXBSIZE MAXFRAG */
#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <util.h>
/* the optimization warning string template */
static int
openpartition(char *name, int flags, char **devicep)
{
- char rawspec[MAXPATHLEN], *p;
+ char rawspec[PATH_MAX], *p;
struct fstab *fs;
int fd;
-/* $OpenBSD: umount.c,v 1.25 2014/02/21 19:00:01 deraadt Exp $ */
+/* $OpenBSD: umount.c,v 1.26 2015/01/16 06:40:01 deraadt Exp $ */
/* $NetBSD: umount.c,v 1.16 1996/05/11 14:13:55 mycroft Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <sys/time.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <util.h>
typedef enum { MNTON, MNTFROM } mntwhat;
CLIENT *clp;
int so;
char *delimp, *hostp, *mntpt;
- char *name, *newname, rname[MAXPATHLEN], type[MFSNAMELEN];
+ char *name, *newname, rname[PATH_MAX], type[MFSNAMELEN];
if (isduid(oname, 0) || realpath(oname, rname) == NULL)
mntpt = name = oname;
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MACHINE MACHINE_ARCH */
#include <err.h>
#include <locale.h>
-/* $OpenBSD: aparams.c,v 1.14 2012/04/11 06:05:43 ratchov Exp $ */
+/* $OpenBSD: aparams.c,v 1.15 2015/01/16 06:40:05 deraadt Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <endian.h>
+
#include "aparams.h"
#ifdef DEBUG
#include "dbg.h"
-/* $OpenBSD: aparams.h,v 1.12 2012/04/11 06:05:43 ratchov Exp $ */
+/* $OpenBSD: aparams.h,v 1.13 2015/01/16 06:40:05 deraadt Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
#ifndef APARAMS_H
#define APARAMS_H
-#include <sys/param.h>
-
#define NCHAN_MAX 16 /* max channel in a stream */
#define RATE_MIN 4000 /* min sample rate */
#define RATE_MAX 192000 /* max sample rate */
-/* $OpenBSD: aucat.c,v 1.144 2013/11/18 17:51:59 ratchov Exp $ */
+/* $OpenBSD: aucat.c,v 1.145 2015/01/16 06:40:05 deraadt Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+
#include <sys/queue.h>
#include <sys/stat.h>
#include <sys/types.h>
-/* $OpenBSD: headers.c,v 1.23 2013/11/18 17:37:45 ratchov Exp $ */
+/* $OpenBSD: headers.c,v 1.24 2015/01/16 06:40:05 deraadt Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
-
#include <err.h>
#include <stdio.h>
#include <stdint.h>
-/* $OpenBSD: bgplg.c,v 1.12 2013/11/25 18:02:50 deraadt Exp $ */
+/* $OpenBSD: bgplg.c,v 1.13 2015/01/16 06:40:06 deraadt Exp $ */
/*
* Copyright (c) 2005, 2006 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/stat.h>
#include <sys/types.h>
-#include <sys/param.h>
+#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
{
char *query, *self, *cmd = NULL, *req;
char **argv = NULL;
- char myname[MAXHOSTNAMELEN];
+ char myname[HOST_NAME_MAX+1];
int ret = 1, argc = 0, query_length = 0;
struct stat st;
u_int i;
-/* $OpenBSD: bgplgsh.c,v 1.6 2013/11/25 18:02:50 deraadt Exp $ */
+/* $OpenBSD: bgplgsh.c,v 1.7 2015/01/16 06:40:06 deraadt Exp $ */
/*
* Copyright (c) 2005, 2006 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/stat.h>
#include <sys/types.h>
-#include <sys/param.h>
+#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
main(void)
{
struct cmd *cmd = NULL;
- char prompt[MAXHOSTNAMELEN], *line, **argp = NULL;
+ char prompt[HOST_NAME_MAX+1], *line, **argp = NULL;
int ncmd, ret, v = -1;
u_int i;
-/* $OpenBSD: io.c,v 1.36 2013/11/26 13:18:53 deraadt Exp $ */
+/* $OpenBSD: io.c,v 1.37 2015/01/16 06:40:06 deraadt Exp $ */
/*
* Copyright (c) 1989, 1993, 1994
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <string.h>
#include <tzfile.h>
#include <unistd.h>
+#include <limits.h>
#include "pathnames.h"
#include "calendar.h"
-/* $OpenBSD: cap_mkdb.c,v 1.18 2011/07/04 21:34:54 nicm Exp $ */
+/* $OpenBSD: cap_mkdb.c,v 1.19 2015/01/16 06:40:06 deraadt Exp $ */
/* $NetBSD: cap_mkdb.c,v 1.5 1995/09/02 05:47:12 jtc Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <db.h>
#include <ctype.h>
#include <unistd.h>
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
void db_build(char **);
void dounlink(void);
void usage(void);
*/
len = strlen(bp);
if (bplen <= 4 * len + 2) {
- int newbplen = bplen + MAX(256, 4 * len + 2);
+ int newbplen = bplen + MAXIMUM(256, 4 * len + 2);
void *newdata;
if ((newdata = realloc(data.data, newbplen)) == NULL)
/* Find the end of the name field. */
if ((p = strchr(bp, info ? ',' : ':')) == NULL) {
- warnx("no name field: %.*s", (int)MIN(len, 20), bp);
+ warnx("no name field: %.*s", (int)MINIMUM(len, 20), bp);
continue;
}
}
*out++ = '\0';
if (memchr((char *)data.data + 1, '\0', data.size - 2)) {
- warnx("NUL in entry: %.*s", (int)MIN(len, 20), bp);
+ warnx("NUL in entry: %.*s", (int)MINIMUM(len, 20), bp);
continue;
}
} else {
-/* $OpenBSD: cddb.c,v 1.19 2014/01/06 12:38:10 espie Exp $ */
+/* $OpenBSD: cddb.c,v 1.20 2015/01/16 06:40:06 deraadt Exp $ */
/*
* Copyright (c) 2002 Marc Espie.
*
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/cdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <vis.h>
#include "extern.h"
void
send_hello(FILE *cout)
{
- char hostname[MAXHOSTNAMELEN];
+ char hostname[HOST_NAME_MAX+1];
if (gethostname(hostname, sizeof(hostname)) == -1)
strlcpy(hostname, "unknown", sizeof hostname);
-/* $OpenBSD: cdio.c,v 1.73 2013/11/20 20:54:34 deraadt Exp $ */
+/* $OpenBSD: cdio.c,v 1.74 2015/01/16 06:40:06 deraadt Exp $ */
/* Copyright (c) 1995 Serge V. Vakulenko
* All rights reserved.
* $FreeBSD: cdcontrol.c,v 1.13 1996/06/25 21:01:27 ache Exp $
*/
-#include <sys/param.h>
+#include <sys/param.h> /* isset */
#include <sys/file.h>
#include <sys/cdio.h>
#include <sys/ioctl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <histedit.h>
#include <util.h>
#include <vis.h>
run(int cmd, char *arg)
{
int l, r, rc;
- static char newcdname[MAXPATHLEN];
+ static char newcdname[PATH_MAX];
switch (cmd) {
-/* $OpenBSD: mmc.c,v 1.29 2013/11/12 17:57:34 deraadt Exp $ */
+/* $OpenBSD: mmc.c,v 1.30 2015/01/16 06:40:06 deraadt Exp $ */
/*
* Copyright (c) 2006 Michael Coulter <mjc@openbsd.org>
*
#include <sys/limits.h>
#include <sys/types.h>
#include <sys/scsiio.h>
-#include <sys/param.h>
+#include <sys/param.h> /* setbit, isset */
#include <scsi/cd.h>
#include <scsi/scsi_all.h>
#include <scsi/scsi_disk.h>
-/* $OpenBSD: chpass.c,v 1.40 2014/10/26 20:38:13 guenther Exp $ */
+/* $OpenBSD: chpass.c,v 1.41 2015/01/16 06:40:06 deraadt Exp $ */
/* $NetBSD: chpass.c,v 1.8 1996/05/15 21:50:43 jtc Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/time.h>
-/* $OpenBSD: edit.c,v 1.34 2013/11/26 13:18:55 deraadt Exp $ */
+/* $OpenBSD: edit.c,v 1.35 2015/01/16 06:40:06 deraadt Exp $ */
/* $NetBSD: edit.c,v 1.6 1996/05/15 21:50:45 jtc Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <util.h>
#include "chpass.h"
-/* $OpenBSD: field.c,v 1.13 2013/11/26 13:18:55 deraadt Exp $ */
+/* $OpenBSD: field.c,v 1.14 2015/01/16 06:40:06 deraadt Exp $ */
/* $NetBSD: field.c,v 1.3 1995/03/26 04:55:28 glass Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
-
#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "chpass.h"
-/* $OpenBSD: regular.c,v 1.10 2011/01/19 13:01:25 okan Exp $ */
+/* $OpenBSD: regular.c,v 1.11 2015/01/16 06:40:06 deraadt Exp $ */
/* $NetBSD: regular.c,v 1.2 1995/09/08 03:22:59 tls Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include "extern.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
void
c_regular(int fd1, char *file1, off_t skip1, off_t len1,
int fd2, char *file2, off_t skip2, off_t len2)
eofmsg(file2);
len2 -= skip2;
- length = MIN(len1, len2);
+ length = MINIMUM(len1, len2);
if (length > SIZE_T_MAX) {
mmap_failed:
c_special(fd1, file1, skip1, fd2, file2, skip2);
-/* $OpenBSD: gzopen.c,v 1.27 2011/09/22 10:41:04 deraadt Exp $ */
+/* $OpenBSD: gzopen.c,v 1.28 2015/01/16 06:40:06 deraadt Exp $ */
/*
* Copyright (c) 1997 Michael Shalayeff
(zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/uio.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
+#include <limits.h>
#include <zlib.h>
#include "compress.h"
if ((flags & ORIG_NAME) != 0) { /* read/save the original file name */
if ((ep = name) != NULL)
- ep += MAXPATHLEN - 1;
+ ep += PATH_MAX - 1;
while ((c = get_byte(s)) != EOF) {
s->z_hlen++;
if (c == '\0')
-/* $OpenBSD: main.c,v 1.82 2014/10/08 03:59:11 doug Exp $ */
+/* $OpenBSD: main.c,v 1.83 2015/01/16 06:40:06 deraadt Exp $ */
/*
* Copyright (c) 1992, 1993
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <stdbool.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <fcntl.h>
#include <paths.h>
#include "compress.h"
const struct compressor *method;
const char *optstr, *s;
char *p, *infile;
- char outfile[MAXPATHLEN], _infile[MAXPATHLEN], suffix[16];
+ char outfile[PATH_MAX], _infile[PATH_MAX], suffix[16];
int bits, ch, error, rc, cflag, oflag;
bits = cflag = oflag = 0;
int bits, struct stat *sb)
{
u_char buf[Z_BUFSIZE];
- char oldname[MAXPATHLEN];
+ char oldname[PATH_MAX];
int error, oreg, ifd, ofd;
void *cookie;
ssize_t nr;
char *cp = strrchr(out, '/');
if (cp != NULL) {
*(cp + 1) = '\0';
- strlcat(out, oldname, MAXPATHLEN);
+ strlcat(out, oldname, PATH_MAX);
} else
- strlcpy(out, oldname, MAXPATHLEN);
+ strlcpy(out, oldname, PATH_MAX);
cat = 0; /* XXX should -c override? */
}
-/* $OpenBSD: zopen.c,v 1.18 2011/09/22 10:41:04 deraadt Exp $ */
+/* $OpenBSD: zopen.c,v 1.19 2015/01/16 06:40:06 deraadt Exp $ */
/* $NetBSD: zopen.c,v 1.5 1995/03/26 09:44:53 glass Exp $ */
/*-
* Any file produced by compress(1) can be read.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <ctype.h>
#include <fcntl.h>
#include "compress.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
#define BITS 16 /* Default bits. */
#define HSIZE 69001 /* 95% occupancy */
#define ZBUFSIZ 8192 /* I/O buffer size */
zs->zs_ebp = bp + bits;
}
zs->zs_offset = 0;
- zs->zs_size = MIN(zs->zs_n_bits, zs->zs_ebp - zs->zs_bp);
+ zs->zs_size = MINIMUM(zs->zs_n_bits, zs->zs_ebp - zs->zs_bp);
if (zs->zs_size == 0)
return -1;
/* Round size down to integral number of codes. */
-/* $OpenBSD: cu.c,v 1.19 2014/04/12 12:47:43 nicm Exp $ */
+/* $OpenBSD: cu.c,v 1.20 2015/01/16 06:40:06 deraadt Exp $ */
/*
* Copyright (c) 2012 Nicholas Marriott <nicm@openbsd.org>
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/ioctl.h>
#include <ctype.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
+#include <limits.h>
#include "cu.h"
if ((rv = asprintf(&out, "%s%s%s", pw->pw_dir, sep, filename)) == -1)
cu_err(1, "asprintf");
- if (rv >= MAXPATHLEN) {
+ if (rv >= PATH_MAX) {
free(out);
goto no_change;
}
-/* $OpenBSD: add.c,v 1.110 2010/11/11 21:00:59 nicm Exp $ */
+/* $OpenBSD: add.c,v 1.111 2015/01/16 06:40:06 deraadt Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
void
cvs_add_remote(struct cvs_file *cf)
{
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
cvs_log(LP_TRACE, "cvs_add_remote(%s)", cf->file_path);
cvs_file_classify(cf, cvs_directory_tag);
if (cf->file_type == CVS_DIR) {
- cvs_get_repository_path(cf->file_wd, path, MAXPATHLEN);
+ cvs_get_repository_path(cf->file_wd, path, PATH_MAX);
if (strlcat(path, "/", sizeof(path)) >= sizeof(path))
fatal("cvs_add_remote: truncation");
if (strlcat(path, cf->file_path, sizeof(path)) >= sizeof(path))
cvs_add_loginfo(char *repo)
{
BUF *buf;
- char pwd[MAXPATHLEN];
+ char pwd[PATH_MAX];
if (getcwd(pwd, sizeof(pwd)) == NULL)
fatal("Can't get working directory");
cvs_add_tobranch(struct cvs_file *cf, char *tag)
{
BUF *bp;
- char attic[MAXPATHLEN], repo[MAXPATHLEN];
+ char attic[PATH_MAX], repo[PATH_MAX];
char *msg;
struct stat st;
RCSNUM *branch;
if (fstat(cf->fd, &st) == -1)
fatal("cvs_add_tobranch: %s", strerror(errno));
- cvs_get_repository_path(cf->file_wd, repo, MAXPATHLEN);
- (void)xsnprintf(attic, MAXPATHLEN, "%s/%s",
+ cvs_get_repository_path(cf->file_wd, repo, PATH_MAX);
+ (void)xsnprintf(attic, PATH_MAX, "%s/%s",
repo, CVS_PATH_ATTIC);
if (mkdir(attic, 0755) == -1 && errno != EEXIST)
fatal("cvs_add_tobranch: failed to create Attic");
- (void)xsnprintf(attic, MAXPATHLEN, "%s/%s/%s%s", repo,
+ (void)xsnprintf(attic, PATH_MAX, "%s/%s/%s%s", repo,
CVS_PATH_ATTIC, cf->file_name, RCS_FILE_EXT);
xfree(cf->file_rpath);
int added, nb;
struct stat st;
CVSENTRIES *entlist;
- char *date, entry[MAXPATHLEN], msg[1024], repo[MAXPATHLEN], *tag, *p;
+ char *date, entry[PATH_MAX], msg[1024], repo[PATH_MAX], *tag, *p;
struct file_info_list files_info;
struct file_info *fi;
struct trigger_list *line_list;
cvs_log(LP_TRACE, "add_directory(%s)", cf->file_path);
- (void)xsnprintf(entry, MAXPATHLEN, "%s%s",
+ (void)xsnprintf(entry, PATH_MAX, "%s%s",
cf->file_rpath, RCS_FILE_EXT);
added = 1;
/* Let's see if we have any per-directory tags first. */
cvs_parse_tagfile(cf->file_wd, &tag, &date, &nb);
- (void)xsnprintf(entry, MAXPATHLEN, "%s/%s",
+ (void)xsnprintf(entry, PATH_MAX, "%s/%s",
cf->file_path, CVS_PATH_CVSDIR);
if (cvs_server_active) {
strerror(errno));
cvs_get_repository_name(cf->file_wd, repo,
- MAXPATHLEN);
+ PATH_MAX);
- (void)xsnprintf(entry, MAXPATHLEN, "%s/%s",
+ (void)xsnprintf(entry, PATH_MAX, "%s/%s",
repo, cf->file_name);
cvs_mkadmin(cf->file_path, current_cvsroot->cr_dir,
if (date != NULL)
xfree(date);
- cvs_get_repository_name(cf->file_path, repo, MAXPATHLEN);
+ cvs_get_repository_name(cf->file_path, repo, PATH_MAX);
line_list = cvs_trigger_getlines(CVS_PATH_LOGINFO, repo);
if (line_list != NULL) {
TAILQ_INIT(&files_info);
add_entry(struct cvs_file *cf)
{
FILE *fp;
- char *entry, path[MAXPATHLEN];
+ char *entry, path[PATH_MAX];
char revbuf[CVS_REV_BUFSZ], tbuf[CVS_TIME_BUFSZ];
char sticky[CVS_ENT_MAXLINELEN];
CVSENTRIES *entlist;
0, 0, entry, CVS_ENT_MAXLINELEN);
} else {
if (logmsg != NULL) {
- (void)xsnprintf(path, MAXPATHLEN, "%s/%s/%s%s",
+ (void)xsnprintf(path, PATH_MAX, "%s/%s/%s%s",
cf->file_wd, CVS_PATH_CVSDIR, cf->file_name,
CVS_DESCR_FILE_EXT);
-/* $OpenBSD: admin.c,v 1.64 2008/09/12 13:20:36 tobias Exp $ */
+/* $OpenBSD: admin.c,v 1.65 2015/01/16 06:40:06 deraadt Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/dirent.h>
#include <errno.h>
struct cvs_file *ocf;
struct rcs_access *acp;
int ofd;
- char *d, *f, fpath[MAXPATHLEN], repo[MAXPATHLEN];
+ char *d, *f, fpath[PATH_MAX], repo[PATH_MAX];
if ((f = basename(oldfilename)) == NULL)
if ((d = dirname(oldfilename)) == NULL)
fatal("cvs_admin_local: dirname failed");
- cvs_get_repository_path(d, repo, MAXPATHLEN);
+ cvs_get_repository_path(d, repo, PATH_MAX);
- (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s", repo, f);
+ (void)xsnprintf(fpath, PATH_MAX, "%s/%s", repo, f);
- if (strlcat(fpath, RCS_FILE_EXT, MAXPATHLEN) >= MAXPATHLEN)
+ if (strlcat(fpath, RCS_FILE_EXT, PATH_MAX) >= PATH_MAX)
fatal("cvs_admin_local: truncation");
if ((ofd = open(fpath, O_RDONLY)) == -1)
-/* $OpenBSD: annotate.c,v 1.63 2011/12/27 13:59:01 nicm Exp $ */
+/* $OpenBSD: annotate.c,v 1.64 2015/01/16 06:40:06 deraadt Exp $ */
/*
* Copyright (c) 2007 Tobias Stoeckmann <tobias@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/dirent.h>
#include <errno.h>
-/* $OpenBSD: atomicio.c,v 1.1 2007/09/17 10:07:21 tobias Exp $ */
+/* $OpenBSD: atomicio.c,v 1.2 2015/01/16 06:40:06 deraadt Exp $ */
/*
* Copyright (c) 2006 Damien Miller. All rights reserved.
* Copyright (c) 2005 Anil Madhavapeddy. All rights reserved.
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <errno.h>
#include <poll.h>
-/* $OpenBSD: checkout.c,v 1.168 2011/12/27 13:59:01 nicm Exp $ */
+/* $OpenBSD: checkout.c,v 1.169 2015/01/16 06:40:06 deraadt Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/dirent.h>
#include <sys/stat.h>
#include <sys/time.h>
struct module_checkout *mc;
struct cvs_ignpat *ip;
struct cvs_filelist *fl, *nxt;
- char repo[MAXPATHLEN], fpath[MAXPATHLEN], *f[1];
+ char repo[PATH_MAX], fpath[PATH_MAX], *f[1];
build_dirs = print_stdout ? 0 : 1;
static int
checkout_classify(const char *repo, const char *arg)
{
- char *d, *f, fpath[MAXPATHLEN];
+ char *d, *f, fpath[PATH_MAX];
struct stat sb;
if (stat(repo, &sb) == 0) {
char *entry, *tosend;
char kbuf[8], sticky[CVS_REV_BUFSZ], rev[CVS_REV_BUFSZ];
char timebuf[CVS_TIME_BUFSZ], tbuf[CVS_TIME_BUFSZ];
- static char lastwd[MAXPATHLEN];
+ static char lastwd[PATH_MAX];
exists = 0;
tosend = NULL;
*/
if (tag != NULL && strcmp(cf->file_wd, lastwd) &&
!(cf->file_flags & FILE_USER_SUPPLIED)) {
- strlcpy(lastwd, cf->file_wd, MAXPATHLEN);
+ strlcpy(lastwd, cf->file_wd, PATH_MAX);
cvs_server_set_sticky(cf->file_wd, sticky);
}
-/* $OpenBSD: client.c,v 1.123 2010/09/29 18:14:52 nicm Exp $ */
+/* $OpenBSD: client.c,v 1.124 2015/01/16 06:40:06 deraadt Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/dirent.h>
#include <sys/stat.h>
#include <sys/time.h>
{
struct stat st;
int nb;
- char *d, *date, fpath[MAXPATHLEN], repo[MAXPATHLEN], *tag;
+ char *d, *date, fpath[PATH_MAX], repo[PATH_MAX], *tag;
d = NULL;
if (lastdir != NULL && !strcmp(dir, lastdir))
return;
- cvs_get_repository_path(dir, repo, MAXPATHLEN);
+ cvs_get_repository_path(dir, repo, PATH_MAX);
if (cvs_cmdop != CVS_OP_RLOG)
cvs_client_send_request("Directory %s\n%s", dir, repo);
- (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s",
+ (void)xsnprintf(fpath, PATH_MAX, "%s/%s",
dir, CVS_PATH_STATICENTRIES);
if (stat(fpath, &st) == 0 && (st.st_mode & (S_IRUSR|S_IRGRP|S_IROTH)))
const char *errstr;
struct tm datetm;
struct timeval tv[2];
- char repo[MAXPATHLEN], *entry;
+ char repo[PATH_MAX], *entry;
char timebuf[CVS_TIME_BUFSZ], revbuf[CVS_REV_BUFSZ];
char *en, *mode, *len, *rpath, *p;
- char sticky[CVS_ENT_MAXLINELEN], fpath[MAXPATHLEN];
+ char sticky[CVS_ENT_MAXLINELEN], fpath[PATH_MAX];
if (data == NULL)
fatal("Missing argument for Updated");
len = cvs_remote_input();
client_check_directory(data, rpath);
- cvs_get_repository_path(".", repo, MAXPATHLEN);
+ cvs_get_repository_path(".", repo, PATH_MAX);
STRIP_SLASH(repo);
client_check_directory(data, rpath);
- repo = xmalloc(MAXPATHLEN);
- cvs_get_repository_path(".", repo, MAXPATHLEN);
+ repo = xmalloc(PATH_MAX);
+ cvs_get_repository_path(".", repo, PATH_MAX);
STRIP_SLASH(repo);
cvs_client_removed(char *data)
{
CVSENTRIES *entlist;
- char *rpath, *filename, fpath[MAXPATHLEN];
+ char *rpath, *filename, fpath[PATH_MAX];
if (data == NULL)
fatal("Missing argument for Removed");
entlist = cvs_ent_open(data);
cvs_ent_remove(entlist, filename);
- (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s", data, filename);
+ (void)xsnprintf(fpath, PATH_MAX, "%s/%s", data, filename);
(void)unlink(fpath);
xfree(rpath);
cvs_client_set_static_directory(char *data)
{
FILE *fp;
- char *dir, fpath[MAXPATHLEN];
+ char *dir, fpath[PATH_MAX];
if (data == NULL)
fatal("Missing argument for Set-static-directory");
if (cvs_cmdop == CVS_OP_EXPORT)
return;
- (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s",
+ (void)xsnprintf(fpath, PATH_MAX, "%s/%s",
data, CVS_PATH_STATICENTRIES);
if ((fp = fopen(fpath, "w+")) == NULL) {
void
cvs_client_clear_static_directory(char *data)
{
- char *dir, fpath[MAXPATHLEN];
+ char *dir, fpath[PATH_MAX];
if (data == NULL)
fatal("Missing argument for Clear-static-directory");
if (cvs_cmdop == CVS_OP_EXPORT)
return;
- (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s",
+ (void)xsnprintf(fpath, PATH_MAX, "%s/%s",
data, CVS_PATH_STATICENTRIES);
(void)cvs_unlink(fpath);
cvs_client_set_sticky(char *data)
{
FILE *fp;
- char *dir, *tag, tagpath[MAXPATHLEN];
+ char *dir, *tag, tagpath[PATH_MAX];
if (data == NULL)
fatal("Missing argument for Set-sticky");
client_check_directory(data, dir);
- (void)xsnprintf(tagpath, MAXPATHLEN, "%s/%s", data, CVS_PATH_TAG);
+ (void)xsnprintf(tagpath, PATH_MAX, "%s/%s", data, CVS_PATH_TAG);
if ((fp = fopen(tagpath, "w+")) == NULL) {
cvs_log(LP_ERRNO, "%s", tagpath);
void
cvs_client_clear_sticky(char *data)
{
- char *dir, tagpath[MAXPATHLEN];
+ char *dir, tagpath[PATH_MAX];
if (data == NULL)
fatal("Missing argument for Clear-sticky");
client_check_directory(data, dir);
- (void)xsnprintf(tagpath, MAXPATHLEN, "%s/%s", data, CVS_PATH_TAG);
+ (void)xsnprintf(tagpath, PATH_MAX, "%s/%s", data, CVS_PATH_TAG);
(void)unlink(tagpath);
xfree(dir);
cvs_client_initlog(void)
{
u_int i;
- char *env, *envdup, buf[MAXPATHLEN], fpath[MAXPATHLEN];
- char rpath[MAXPATHLEN], timebuf[CVS_TIME_BUFSZ], *s;
+ char *env, *envdup, buf[PATH_MAX], fpath[PATH_MAX];
+ char rpath[PATH_MAX], timebuf[CVS_TIME_BUFSZ], *s;
struct stat st;
time_t now;
struct passwd *pwd;
-/* $OpenBSD: cmd.c,v 1.68 2008/02/03 18:18:44 tobias Exp $ */
+/* $OpenBSD: cmd.c,v 1.69 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/dirent.h>
#include <string.h>
-/* $OpenBSD: commit.c,v 1.152 2011/12/27 13:59:01 nicm Exp $ */
+/* $OpenBSD: commit.c,v 1.153 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
struct cvs_recursion cr;
struct cvs_filelist *l;
struct file_info *fi;
- char *arg = ".", repo[MAXPATHLEN];
+ char *arg = ".", repo[PATH_MAX];
flags = CR_RECURSE_DIRS;
Fflag = mflag = 0;
cvs_client_send_request("ci");
cvs_client_get_responses();
} else {
- cvs_get_repository_name(".", repo, MAXPATHLEN);
+ cvs_get_repository_name(".", repo, PATH_MAX);
line_list = cvs_trigger_getlines(CVS_PATH_COMMITINFO, repo);
if (line_list != NULL) {
cvs_commit_loginfo(char *repo)
{
BUF *buf;
- char pwd[MAXPATHLEN];
+ char pwd[PATH_MAX];
struct cvs_filelist *cf;
if (getcwd(pwd, sizeof(pwd)) == NULL)
void
cvs_commit_lock_dirs(struct cvs_file *cf)
{
- char repo[MAXPATHLEN];
+ char repo[PATH_MAX];
cvs_get_repository_path(cf->file_wd, repo, sizeof(repo));
cvs_log(LP_TRACE, "cvs_commit_lock_dirs: %s", repo);
int openflags, rcsflags;
char rbuf[CVS_REV_BUFSZ], nbuf[CVS_REV_BUFSZ];
CVSENTRIES *entlist;
- char attic[MAXPATHLEN], repo[MAXPATHLEN], rcsfile[MAXPATHLEN];
+ char attic[PATH_MAX], repo[PATH_MAX], rcsfile[PATH_MAX];
struct file_info *fi;
cvs_log(LP_TRACE, "cvs_commit_local(%s)", cf->file_path);
"to be dead", cf->file_path);
cvs_get_repository_path(cf->file_wd, repo,
- MAXPATHLEN);
- (void)xsnprintf(rcsfile, MAXPATHLEN, "%s/%s%s",
+ PATH_MAX);
+ (void)xsnprintf(rcsfile, PATH_MAX, "%s/%s%s",
repo, cf->file_name, RCS_FILE_EXT);
if (rename(cf->file_rpath, rcsfile) == -1)
entlist = cvs_ent_open(cf->file_wd);
cvs_ent_remove(entlist, cf->file_name);
- cvs_get_repository_path(cf->file_wd, repo, MAXPATHLEN);
+ cvs_get_repository_path(cf->file_wd, repo, PATH_MAX);
- (void)xsnprintf(attic, MAXPATHLEN, "%s/%s",
+ (void)xsnprintf(attic, PATH_MAX, "%s/%s",
repo, CVS_PATH_ATTIC);
if (mkdir(attic, 0755) == -1 && errno != EEXIST)
fatal("cvs_commit_local: failed to create Attic");
- (void)xsnprintf(attic, MAXPATHLEN, "%s/%s/%s%s", repo,
+ (void)xsnprintf(attic, PATH_MAX, "%s/%s/%s%s", repo,
CVS_PATH_ATTIC, cf->file_name, RCS_FILE_EXT);
if (rename(cf->file_rpath, attic) == -1)
{
BUF *bp;
int fd;
- char desc_path[MAXPATHLEN], *desc;
+ char desc_path[PATH_MAX], *desc;
- (void)xsnprintf(desc_path, MAXPATHLEN, "%s/%s/%s%s",
+ (void)xsnprintf(desc_path, PATH_MAX, "%s/%s/%s%s",
cf->file_wd, CVS_PATH_CVSDIR, cf->file_name, CVS_DESCR_FILE_EXT);
if ((fd = open(desc_path, O_RDONLY)) == -1)
-/* $OpenBSD: config.c,v 1.15 2008/03/02 11:58:45 joris Exp $ */
+/* $OpenBSD: config.c,v 1.16 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/dirent.h>
#include <sys/resource.h>
FILE *fp;
size_t len;
int lineno;
- char *p, *buf, *lbuf, fpath[MAXPATHLEN];
+ char *p, *buf, *lbuf, fpath[PATH_MAX];
(void)xsnprintf(fpath, sizeof(fpath), "%s/%s",
current_cvsroot->cr_dir, name);
-/* $OpenBSD: cvs.c,v 1.154 2014/12/01 21:58:46 deraadt Exp $ */
+/* $OpenBSD: cvs.c,v 1.155 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2006, 2007 Joris Vink <joris@openbsd.org>
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
int i, ret, cmd_argc;
struct passwd *pw;
struct stat st;
- char fpath[MAXPATHLEN];
+ char fpath[PATH_MAX];
tzset();
static void
cvs_read_rcfile(void)
{
- char rcpath[MAXPATHLEN], *buf, *lbuf, *lp, *p;
+ char rcpath[PATH_MAX], *buf, *lbuf, *lp, *p;
int cmd_parsed, cvs_parsed, i, linenum;
size_t len, pos;
struct cvs_cmd *tcmdp;
linenum = 0;
- i = snprintf(rcpath, MAXPATHLEN, "%s/%s", cvs_homedir, CVS_PATH_RC);
- if (i < 0 || i >= MAXPATHLEN) {
+ i = snprintf(rcpath, PATH_MAX, "%s/%s", cvs_homedir, CVS_PATH_RC);
+ if (i < 0 || i >= PATH_MAX) {
cvs_log(LP_ERRNO, "%s", rcpath);
return;
}
-/* $OpenBSD: diff3.c,v 1.56 2014/12/01 21:58:46 deraadt Exp $ */
+/* $OpenBSD: diff3.c,v 1.57 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
static int eflag;
static int oflag; /* indicates whether to mark overlaps (-E or -X)*/
static int debug = 0;
-static char f1mark[MAXPATHLEN], f3mark[MAXPATHLEN]; /* markers for -E and -X */
+static char f1mark[PATH_MAX], f3mark[PATH_MAX]; /* markers for -E and -X */
static int duplicate(struct range *, struct range *);
static int edit(struct diff *, int, int);
-/* $OpenBSD: diff_internals.c,v 1.35 2014/12/01 21:58:46 deraadt Exp $ */
+/* $OpenBSD: diff_internals.c,v 1.36 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
* All rights reserved.
* @(#)diffreg.c 8.1 (Berkeley) 6/6/93
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
#include "cvs.h"
#include "diff.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
/*
* diff - compare two files.
*/
bound = UINT_MAX;
else {
sq = isqrt(n);
- bound = MAX(256, sq);
+ bound = MAXIMUM(256, sq);
}
k = 0;
return;
b = d = 0; /* gcc */
- lowa = MAX(1, cvp->a - diff_context);
- upb = MIN(len[0], context_vec_ptr->b + diff_context);
- lowc = MAX(1, cvp->c - diff_context);
- upd = MIN(len[1], context_vec_ptr->d + diff_context);
+ lowa = MAXIMUM(1, cvp->a - diff_context);
+ upb = MINIMUM(len[0], context_vec_ptr->b + diff_context);
+ lowc = MAXIMUM(1, cvp->c - diff_context);
+ upd = MINIMUM(len[1], context_vec_ptr->d + diff_context);
diff_output("***************");
if ((flags & D_PROTOTYPE)) {
return;
b = d = 0; /* gcc */
- lowa = MAX(1, cvp->a - diff_context);
- upb = MIN(len[0], context_vec_ptr->b + diff_context);
- lowc = MAX(1, cvp->c - diff_context);
- upd = MIN(len[1], context_vec_ptr->d + diff_context);
+ lowa = MAXIMUM(1, cvp->a - diff_context);
+ upb = MINIMUM(len[0], context_vec_ptr->b + diff_context);
+ lowc = MAXIMUM(1, cvp->c - diff_context);
+ upd = MINIMUM(len[1], context_vec_ptr->d + diff_context);
diff_output("@@ -");
uni_range(lowa, upb);
-/* $OpenBSD: edit.c,v 1.49 2010/07/09 18:42:14 zinovik Exp $ */
+/* $OpenBSD: edit.c,v 1.50 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2006, 2007 Xavier Santolaria <xsa@openbsd.org>
*
FILE *fp;
struct tm t;
time_t now;
- char timebuf[CVS_TIME_BUFSZ], thishost[MAXHOSTNAMELEN];
- char bfpath[MAXPATHLEN], wdir[MAXPATHLEN];
+ char timebuf[CVS_TIME_BUFSZ], thishost[HOST_NAME_MAX+1];
+ char bfpath[PATH_MAX], wdir[PATH_MAX];
if (cvs_noexec == 1)
return;
if (fchmod(cf->fd, 0644) == -1)
fatal("cvs_edit_local: fchmod %s", strerror(errno));
- (void)xsnprintf(bfpath, MAXPATHLEN, "%s/%s",
+ (void)xsnprintf(bfpath, PATH_MAX, "%s/%s",
CVS_PATH_BASEDIR, cf->file_name);
if (mkdir(CVS_PATH_BASEDIR, 0755) == -1 && errno != EEXIST)
struct stat st;
struct tm t;
time_t now;
- char bfpath[MAXPATHLEN], timebuf[64], thishost[MAXHOSTNAMELEN];
- char wdir[MAXPATHLEN], sticky[CVS_ENT_MAXLINELEN];
+ char bfpath[PATH_MAX], timebuf[64], thishost[HOST_NAME_MAX+1];
+ char wdir[PATH_MAX], sticky[CVS_ENT_MAXLINELEN];
RCSNUM *ba_rev;
cvs_log(LP_TRACE, "cvs_unedit_local(%s)", cf->file_path);
cvs_file_classify(cf, cvs_directory_tag);
- (void)xsnprintf(bfpath, MAXPATHLEN, "%s/%s",
+ (void)xsnprintf(bfpath, PATH_MAX, "%s/%s",
CVS_PATH_BASEDIR, cf->file_name);
if (stat(bfpath, &st) == -1)
RCSNUM *ba_rev;
int i;
char *dp, *sp;
- char buf[MAXPATHLEN], *fields[2], rbuf[CVS_REV_BUFSZ];
+ char buf[PATH_MAX], *fields[2], rbuf[CVS_REV_BUFSZ];
cvs_log(LP_TRACE, "cvs_base_handle(%s)", cf->file_path);
-/* $OpenBSD: entries.c,v 1.102 2009/03/19 09:53:16 joris Exp $ */
+/* $OpenBSD: entries.c,v 1.103 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
{
FILE *fp;
CVSENTRIES *ep;
- char *p, buf[MAXPATHLEN];
+ char *p, buf[PATH_MAX];
struct cvs_ent *ent;
struct cvs_ent_line *line;
int i, linenum;
size_t len;
struct tm datetm;
- char linebuf[128], tagpath[MAXPATHLEN];
+ char linebuf[128], tagpath[PATH_MAX];
cvs_directory_date = -1;
if (nbp != NULL)
*nbp = 0;
- i = snprintf(tagpath, MAXPATHLEN, "%s/%s", dir, CVS_PATH_TAG);
- if (i < 0 || i >= MAXPATHLEN)
+ i = snprintf(tagpath, PATH_MAX, "%s/%s", dir, CVS_PATH_TAG);
+ if (i < 0 || i >= PATH_MAX)
return;
if ((fp = fopen(tagpath, "r")) == NULL) {
{
FILE *fp;
RCSNUM *rev;
- char tagpath[MAXPATHLEN];
+ char tagpath[PATH_MAX];
char sticky[CVS_REV_BUFSZ];
struct tm datetm;
int i;
if (cvs_noexec == 1)
return;
- i = snprintf(tagpath, MAXPATHLEN, "%s/%s", dir, CVS_PATH_TAG);
- if (i < 0 || i >= MAXPATHLEN)
+ i = snprintf(tagpath, PATH_MAX, "%s/%s", dir, CVS_PATH_TAG);
+ if (i < 0 || i >= PATH_MAX)
return;
if (tag != NULL || cvs_specified_date != -1 ||
-/* $OpenBSD: file.c,v 1.263 2013/12/13 15:19:41 zhuk Exp $ */
+/* $OpenBSD: file.c,v 1.264 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
{
int i;
FILE *ifp;
- char path[MAXPATHLEN], buf[MAXNAMLEN];
+ char path[PATH_MAX], buf[MAXNAMLEN];
TAILQ_INIT(&cvs_ign_pats);
TAILQ_INIT(&dir_ign_pats);
return;
/* read the cvsignore file in the user's home directory, if any */
- (void)xsnprintf(path, MAXPATHLEN, "%s/.cvsignore", cvs_homedir);
+ (void)xsnprintf(path, PATH_MAX, "%s/.cvsignore", cvs_homedir);
ifp = fopen(path, "r");
if (ifp == NULL) {
struct stat st;
struct cvs_file *cf;
struct cvs_filelist *l, *nxt;
- char *d, *f, repo[MAXPATHLEN], fpath[MAXPATHLEN];
+ char *d, *f, repo[PATH_MAX], fpath[PATH_MAX];
for (l = RB_MIN(cvs_flisthead, fl); l != NULL; l = nxt) {
if (cvs_quit)
goto next;
}
- cvs_get_repository_path(d, repo, MAXPATHLEN);
- (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s",
+ cvs_get_repository_path(d, repo, PATH_MAX);
+ (void)xsnprintf(fpath, PATH_MAX, "%s/%s",
repo, f);
if ((fd = open(fpath, O_RDONLY)) == -1) {
- strlcat(fpath, RCS_FILE_EXT, MAXPATHLEN);
+ strlcat(fpath, RCS_FILE_EXT, PATH_MAX);
fd = open(fpath, O_RDONLY);
}
if (current_cvsroot->cr_method ==
CVS_METHOD_LOCAL) {
cvs_get_repository_path(cf->file_wd,
- repo, MAXPATHLEN);
+ repo, PATH_MAX);
cvs_repository_lock(repo,
(cmdp->cmd_flags & CVS_LOCK_REPO));
}
struct cvs_ent_line *line;
struct cvs_flisthead fl, dl;
CVSENTRIES *entlist;
- char *buf, *ebuf, *cp, repo[MAXPATHLEN], fpath[MAXPATHLEN];
+ char *buf, *ebuf, *cp, repo[PATH_MAX], fpath[PATH_MAX];
cvs_log(LP_TRACE, "cvs_file_walkdir(%s)", cf->file_path);
* If we do not have an admin directory inside here, dont bother,
* unless we are running export or import.
*/
- (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s", cf->file_path,
+ (void)xsnprintf(fpath, PATH_MAX, "%s/%s", cf->file_path,
CVS_PATH_CVSDIR);
l = stat(fpath, &st);
/*
* check for a local .cvsignore file
*/
- (void)xsnprintf(fpath, MAXPATHLEN, "%s/.cvsignore", cf->file_path);
+ (void)xsnprintf(fpath, PATH_MAX, "%s/.cvsignore", cf->file_path);
if ((fp = fopen(fpath, "r")) != NULL) {
- while (fgets(fpath, MAXPATHLEN, fp) != NULL) {
+ while (fgets(fpath, PATH_MAX, fp) != NULL) {
fpath[strcspn(fpath, "\n")] = '\0';
if (fpath[0] == '\0')
continue;
continue;
}
- (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s",
+ (void)xsnprintf(fpath, PATH_MAX, "%s/%s",
cf->file_path, dp->d_name);
/*
TAILQ_FOREACH(line, &(entlist->cef_ent), entries_list) {
ent = cvs_ent_parse(line->buf);
- (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s", cf->file_path,
+ (void)xsnprintf(fpath, PATH_MAX, "%s/%s", cf->file_path,
ent->ce_name);
if (!(cr->flags & CR_RECURSE_DIRS) &&
walkrepo:
if (current_cvsroot->cr_method == CVS_METHOD_LOCAL) {
- cvs_get_repository_path(cf->file_path, repo, MAXPATHLEN);
+ cvs_get_repository_path(cf->file_path, repo, PATH_MAX);
cvs_repository_lock(repo, (cmdp->cmd_flags & CVS_LOCK_REPO));
}
int rflags, ismodified, rcsdead;
CVSENTRIES *entlist = NULL;
const char *state;
- char repo[MAXPATHLEN], rcsfile[MAXPATHLEN];
+ char repo[PATH_MAX], rcsfile[PATH_MAX];
cvs_log(LP_TRACE, "cvs_file_classify(%s, %s)", cf->file_path,
(tag != NULL) ? tag : "none");
return;
}
- cvs_get_repository_path(cf->file_wd, repo, MAXPATHLEN);
- (void)xsnprintf(rcsfile, MAXPATHLEN, "%s/%s",
+ cvs_get_repository_path(cf->file_wd, repo, PATH_MAX);
+ (void)xsnprintf(rcsfile, PATH_MAX, "%s/%s",
repo, cf->file_name);
if (cf->file_type == CVS_FILE) {
- len = strlcat(rcsfile, RCS_FILE_EXT, MAXPATHLEN);
- if (len >= MAXPATHLEN)
+ len = strlcat(rcsfile, RCS_FILE_EXT, PATH_MAX);
+ if (len >= PATH_MAX)
fatal("cvs_file_classify: truncation");
}
if (cf->file_rcs == NULL)
fatal("cvs_file_classify: failed to parse RCS");
} else {
- (void)xsnprintf(rcsfile, MAXPATHLEN, "%s/%s/%s%s",
+ (void)xsnprintf(rcsfile, PATH_MAX, "%s/%s/%s%s",
repo, CVS_PATH_ATTIC, cf->file_name, RCS_FILE_EXT);
cf->repo_fd = open(rcsfile, O_RDONLY);
-/* $OpenBSD: hash.c,v 1.1 2008/06/21 15:39:15 joris Exp $ */
+/* $OpenBSD: hash.c,v 1.2 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2008 Joris Vink <joris@openbsd.org>
*
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/queue.h>
#include <stdio.h>
-/* $OpenBSD: history.c,v 1.41 2013/12/13 15:19:41 zhuk Exp $ */
+/* $OpenBSD: history.c,v 1.42 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2007 Joris Vink <joris@openbsd.org>
*
size_t len;
int fd;
char *cwd, *p, *rev;
- char revbuf[CVS_REV_BUFSZ], repo[MAXPATHLEN], fpath[MAXPATHLEN];
+ char revbuf[CVS_REV_BUFSZ], repo[PATH_MAX], fpath[PATH_MAX];
char timebuf[CVS_TIME_BUFSZ];
struct tm datetm;
-/* $OpenBSD: import.c,v 1.103 2010/09/23 18:10:16 nicm Exp $ */
+/* $OpenBSD: import.c,v 1.104 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
cvs_import(int argc, char **argv)
{
int i, ch;
- char repo[MAXPATHLEN], *arg = ".";
+ char repo[PATH_MAX], *arg = ".";
struct cvs_recursion cr;
struct trigger_list *line_list;
{
int isnew;
struct stat st;
- char repo[MAXPATHLEN];
+ char repo[PATH_MAX];
cvs_log(LP_TRACE, "cvs_import_local(%s)", cf->file_path);
import_loginfo(char *repo)
{
int i;
- char pwd[MAXPATHLEN];
+ char pwd[PATH_MAX];
if (getcwd(pwd, sizeof(pwd)) == NULL)
fatal("Can't get working directory");
-/* $OpenBSD: init.c,v 1.38 2010/10/31 15:37:34 nicm Exp $ */
+/* $OpenBSD: init.c,v 1.39 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
cvs_init_local(void)
{
u_int i;
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
cvs_log(LP_TRACE, "cvs_init_local()");
init_mkdir(current_cvsroot->cr_dir, 0777);
for (i = 0; i < INIT_NDIRS; i++) {
- (void)xsnprintf(path, MAXPATHLEN, "%s/%s",
+ (void)xsnprintf(path, PATH_MAX, "%s/%s",
current_cvsroot->cr_dir, cvsroot_dirs[i]);
init_mkdir(path, 0777);
}
for (i = 0; i < INIT_NFILES; i++) {
- (void)xsnprintf(path, MAXPATHLEN, "%s/%s",
+ (void)xsnprintf(path, PATH_MAX, "%s/%s",
current_cvsroot->cr_dir, cvsroot_files[i].cf_path);
init_mkfile(path, cvsroot_files[i].cf_content);
BUF *b;
size_t len;
int fd, openflags, rcsflags;
- char rpath[MAXPATHLEN];
+ char rpath[PATH_MAX];
const char **p;
RCSFILE *file;
return;
}
- (void)xsnprintf(rpath, MAXPATHLEN, "%s%s", path, RCS_FILE_EXT);
+ (void)xsnprintf(rpath, PATH_MAX, "%s%s", path, RCS_FILE_EXT);
if ((file = rcs_open(rpath, -1, rcsflags, 0444)) == NULL)
fatal("failed to create RCS file for `%s'", path);
-/* $OpenBSD: logmsg.c,v 1.54 2010/07/23 21:46:05 ray Exp $ */
+/* $OpenBSD: logmsg.c,v 1.55 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2007 Joris Vink <joris@openbsd.org>
*
int c, fd, rd, saved_errno;
struct cvs_filelist *cf;
struct stat st1, st2;
- char *fpath, *logmsg, repo[MAXPATHLEN];
+ char *fpath, *logmsg, repo[PATH_MAX];
struct stat st;
struct trigger_list *line_list;
struct trigger_line *line;
-/* $OpenBSD: modules.c,v 1.17 2014/01/08 13:23:55 okan Exp $ */
+/* $OpenBSD: modules.c,v 1.18 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2008 Joris Vink <joris@openbsd.org>
*
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/dirent.h>
#include <sys/resource.h>
int flags;
struct module_info *mi;
char *bline, *val, *p, *module, *sp, *dp;
- char *dirname, fpath[MAXPATHLEN], *prog;
+ char *dirname, fpath[PATH_MAX], *prog;
prog = NULL;
bline = xstrdup(line);
-/* $OpenBSD: rcs.c,v 1.311 2014/01/08 13:23:55 okan Exp $ */
+/* $OpenBSD: rcs.c,v 1.312 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
#include "rcs.h"
#include "rcsparse.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
#define RCS_KWEXP_SIZE 1024
#define ANNOTATE_NEVER 0
rcs_write(RCSFILE *rfp)
{
FILE *fp;
- char numbuf[CVS_REV_BUFSZ], *fn, tmpdir[MAXPATHLEN];
+ char numbuf[CVS_REV_BUFSZ], *fn, tmpdir[PATH_MAX];
struct rcs_access *ap;
struct rcs_sym *symp;
struct rcs_branch *brp;
* instead of just 2.
*/
if (rfp->rf_head == NULL || rcsnum_cmp(rev, rfp->rf_head,
- MIN(rfp->rf_head->rn_len, rev->rn_len)) < 0) {
+ MINIMUM(rfp->rf_head->rn_len, rev->rn_len)) < 0) {
rcsnum_free(rev);
return (NULL);
}
-/* $OpenBSD: rcsnum.c,v 1.55 2014/01/08 13:23:55 okan Exp $ */
+/* $OpenBSD: rcsnum.c,v 1.56 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
#include "cvs.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
static void rcsnum_setsize(RCSNUM *, u_int);
static char *rcsnum_itoa(u_int16_t, char *, size_t);
if (!rcsnum_differ(n1, n2))
return (0);
- slen = MIN(n1->rn_len, n2->rn_len);
+ slen = MINIMUM(n1->rn_len, n2->rn_len);
if (depth != 0 && slen > depth)
slen = depth;
if (r1->rn_len != r2->rn_len)
return (1);
- len = MIN(r1->rn_len, r2->rn_len);
+ len = MINIMUM(r1->rn_len, r2->rn_len);
for (i = 0; i < len; i++) {
if (r1->rn_id[i] != r2->rn_id[i])
return (1);
-/* $OpenBSD: release.c,v 1.41 2009/03/21 11:18:45 joris Exp $ */
+/* $OpenBSD: release.c,v 1.42 2015/01/16 06:40:07 deraadt Exp $ */
/*-
* Copyright (c) 2005-2007 Xavier Santolaria <xsa@openbsd.org>
*
{
struct stat st;
struct cvs_recursion cr;
- char *wdir, cwd[MAXPATHLEN];
+ char *wdir, cwd[PATH_MAX];
char *arg = ".";
int saved_noexec;
-/* $OpenBSD: remote.c,v 1.29 2010/07/23 21:46:05 ray Exp $ */
+/* $OpenBSD: remote.c,v 1.30 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <sys/param.h> /* MAXBSIZE */
#include <sys/stat.h>
#include <errno.h>
#include "cvs.h"
#include "remote.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
struct cvs_resp *
cvs_remote_get_response_info(const char *response)
{
nleft = len;
while (nleft > 0) {
- toread = MIN(nleft, MAXBSIZE);
+ toread = MINIMUM(nleft, MAXBSIZE);
nread = fread(data, sizeof(char), toread, in);
if (nread == 0)
-/* $OpenBSD: remove.c,v 1.81 2011/12/27 13:59:01 nicm Exp $ */
+/* $OpenBSD: remove.c,v 1.82 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
*
cvs_remove_local(struct cvs_file *cf)
{
CVSENTRIES *entlist;
- char *entry, buf[MAXPATHLEN], tbuf[CVS_TIME_BUFSZ], rbuf[CVS_REV_BUFSZ];
+ char *entry, buf[PATH_MAX], tbuf[CVS_TIME_BUFSZ], rbuf[CVS_REV_BUFSZ];
char sticky[CVS_ENT_MAXLINELEN];
cvs_log(LP_TRACE, "cvs_remove_local(%s)", cf->file_path);
-/* $OpenBSD: repository.c,v 1.23 2010/07/23 08:31:19 ray Exp $ */
+/* $OpenBSD: repository.c,v 1.24 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
void
cvs_repository_unlock(const char *repo)
{
- char fpath[MAXPATHLEN];
+ char fpath[PATH_MAX];
cvs_log(LP_TRACE, "cvs_repository_unlock(%s)", repo);
int i;
uid_t myuid;
struct stat st;
- char fpath[MAXPATHLEN];
+ char fpath[PATH_MAX];
struct passwd *pw;
if (cvs_noexec == 1 || cvs_readonlyfs == 1)
DIR *dirp;
struct stat st;
struct dirent *dp;
- char *s, fpath[MAXPATHLEN], rpath[MAXPATHLEN];
+ char *s, fpath[PATH_MAX], rpath[PATH_MAX];
if ((dirp = opendir(dir)) == NULL)
fatal("cvs_repository_getdir: failed to open '%s'", dir);
!strcmp(dp->d_name, CVS_LOCK))
continue;
- (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s", wdir, dp->d_name);
- (void)xsnprintf(rpath, MAXPATHLEN, "%s/%s", dir, dp->d_name);
+ (void)xsnprintf(fpath, PATH_MAX, "%s/%s", wdir, dp->d_name);
+ (void)xsnprintf(rpath, PATH_MAX, "%s/%s", dir, dp->d_name);
if (!TAILQ_EMPTY(&checkout_ign_pats)) {
if ((s = strrchr(fpath, ',')) != NULL)
-/* $OpenBSD: root.c,v 1.47 2010/10/23 18:36:35 nicm Exp $ */
+/* $OpenBSD: root.c,v 1.48 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
struct cvsroot *
cvsroot_get(const char *dir)
{
- char rootpath[MAXPATHLEN], *rootstr, line[128];
+ char rootpath[PATH_MAX], *rootstr, line[128];
FILE *fp;
if (cvs_rootstr != NULL)
return (NULL);
}
- (void)xsnprintf(rootpath, MAXPATHLEN, "%s/%s", dir, CVS_PATH_ROOTSPEC);
+ (void)xsnprintf(rootpath, PATH_MAX, "%s/%s", dir, CVS_PATH_ROOTSPEC);
if ((fp = fopen(rootpath, "r")) == NULL) {
if (errno == ENOENT) {
-/* $OpenBSD: server.c,v 1.101 2014/12/01 21:58:46 deraadt Exp $ */
+/* $OpenBSD: server.c,v 1.102 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
cvs_server_static_directory(char *data)
{
FILE *fp;
- char fpath[MAXPATHLEN];
+ char fpath[PATH_MAX];
- (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s",
+ (void)xsnprintf(fpath, PATH_MAX, "%s/%s",
server_currentdir, CVS_PATH_STATICENTRIES);
if ((fp = fopen(fpath, "w+")) == NULL) {
cvs_server_sticky(char *data)
{
FILE *fp;
- char tagpath[MAXPATHLEN];
+ char tagpath[PATH_MAX];
if (data == NULL)
fatal("Missing argument for Sticky");
- (void)xsnprintf(tagpath, MAXPATHLEN, "%s/%s",
+ (void)xsnprintf(tagpath, PATH_MAX, "%s/%s",
server_currentdir, CVS_PATH_TAG);
if ((fp = fopen(tagpath, "w+")) == NULL) {
size_t flen;
mode_t fmode;
const char *errstr;
- char *mode, *len, fpath[MAXPATHLEN];
+ char *mode, *len, fpath[PATH_MAX];
if (data == NULL)
fatal("Missing argument for Modified");
fatal("cvs_server_modified: %s", errstr);
xfree(len);
- (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s", server_currentdir, data);
+ (void)xsnprintf(fpath, PATH_MAX, "%s/%s", server_currentdir, data);
if ((fd = open(fpath, O_WRONLY | O_CREAT | O_TRUNC)) == -1)
fatal("cvs_server_modified: %s: %s", fpath, strerror(errno));
void
cvs_server_unchanged(char *data)
{
- char fpath[MAXPATHLEN];
+ char fpath[PATH_MAX];
CVSENTRIES *entlist;
struct cvs_ent *ent;
char sticky[CVS_ENT_MAXLINELEN];
/* sorry, we have to use TMP_DIR */
disable_fast_checkout = 1;
- (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s", server_currentdir, data);
+ (void)xsnprintf(fpath, PATH_MAX, "%s/%s", server_currentdir, data);
entlist = cvs_ent_open(server_currentdir);
ent = cvs_ent_get(entlist, data);
cvs_server_update_entry(const char *resp, struct cvs_file *cf)
{
char *p;
- char repo[MAXPATHLEN], fpath[MAXPATHLEN];
+ char repo[PATH_MAX], fpath[PATH_MAX];
if ((p = strrchr(cf->file_rpath, ',')) != NULL)
*p = '\0';
- cvs_get_repository_path(cf->file_wd, repo, MAXPATHLEN);
- (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s", repo, cf->file_name);
+ cvs_get_repository_path(cf->file_wd, repo, PATH_MAX);
+ (void)xsnprintf(fpath, PATH_MAX, "%s/%s", repo, cf->file_name);
cvs_server_send_response("%s %s/", resp, cf->file_wd);
cvs_remote_output(fpath);
void
cvs_server_set_sticky(const char *dir, const char *tag)
{
- char fpath[MAXPATHLEN];
- char repo[MAXPATHLEN];
+ char fpath[PATH_MAX];
+ char repo[PATH_MAX];
- cvs_get_repository_path(dir, repo, MAXPATHLEN);
- (void)xsnprintf(fpath, MAXPATHLEN, "%s/", repo);
+ cvs_get_repository_path(dir, repo, PATH_MAX);
+ (void)xsnprintf(fpath, PATH_MAX, "%s/", repo);
cvs_server_send_response("Set-sticky %s/", dir);
cvs_remote_output(fpath);
void
cvs_server_clear_sticky(char *dir)
{
- char fpath[MAXPATHLEN];
- char repo[MAXPATHLEN];
+ char fpath[PATH_MAX];
+ char repo[PATH_MAX];
- cvs_get_repository_path(dir, repo, MAXPATHLEN);
- (void)xsnprintf(fpath, MAXPATHLEN, "%s/", repo);
+ cvs_get_repository_path(dir, repo, PATH_MAX);
+ (void)xsnprintf(fpath, PATH_MAX, "%s/", repo);
cvs_server_send_response("Clear-sticky %s//", dir);
cvs_remote_output(fpath);
-/* $OpenBSD: status.c,v 1.93 2010/04/19 13:03:10 millert Exp $ */
+/* $OpenBSD: status.c,v 1.94 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2005-2008 Xavier Santolaria <xsa@openbsd.org>
size_t len;
RCSNUM *head;
const char *status;
- char buf[MAXPATHLEN + CVS_REV_BUFSZ + 128];
+ char buf[PATH_MAX + CVS_REV_BUFSZ + 128];
char timebuf[CVS_TIME_BUFSZ], revbuf[CVS_REV_BUFSZ];
struct rcs_sym *sym;
-/* $OpenBSD: tag.c,v 1.80 2010/10/28 12:30:27 tobias Exp $ */
+/* $OpenBSD: tag.c,v 1.81 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
*
cvs_tag(int argc, char **argv)
{
int ch, flags, i;
- char repo[MAXPATHLEN];
+ char repo[PATH_MAX];
char *arg = ".";
struct cvs_recursion cr;
struct trigger_list *line_list;
cr.flags = flags;
- cvs_get_repository_name(".", repo, MAXPATHLEN);
+ cvs_get_repository_name(".", repo, PATH_MAX);
line_list = cvs_trigger_getlines(CVS_PATH_TAGINFO, repo);
if (line_list != NULL) {
TAILQ_INIT(&files_info);
-/* $OpenBSD: trigger.c,v 1.21 2014/01/08 13:23:55 okan Exp $ */
+/* $OpenBSD: trigger.c,v 1.22 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2008 Tobias Stoeckmann <tobias@openbsd.org>
* Copyright (c) 2008 Jonathan Armani <dbd@asystant.net>
regex_t preg;
struct trigger_list *list;
struct trigger_line *tline;
- char fpath[MAXPATHLEN];
+ char fpath[PATH_MAX];
char *currentline, *defaultline = NULL, *nline, *p, *q, *regex;
if (strcmp(file, CVS_PATH_EDITINFO) == 0 ||
else
allow_all = 1;
- (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s", current_cvsroot->cr_dir,
+ (void)xsnprintf(fpath, PATH_MAX, "%s/%s", current_cvsroot->cr_dir,
file);
if ((fp = fopen(fpath, "r")) == NULL) {
void
cvs_trigger_loginfo_header(BUF *buf, char *repo)
{
- char *dir, pwd[MAXPATHLEN];
- char hostname[MAXHOSTNAMELEN];
+ char *dir, pwd[PATH_MAX];
+ char hostname[HOST_NAME_MAX+1];
if (gethostname(hostname, sizeof(hostname)) == -1) {
fatal("cvs_trigger_loginfo_header: gethostname failed %s",
-/* $OpenBSD: update.c,v 1.168 2013/12/13 15:19:41 zhuk Exp $ */
+/* $OpenBSD: update.c,v 1.169 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
cvs_update_enterdir(struct cvs_file *cf)
{
CVSENTRIES *entlist;
- char *dirtag, *entry, fpath[MAXPATHLEN];
+ char *dirtag, *entry, fpath[PATH_MAX];
cvs_log(LP_TRACE, "cvs_update_enterdir(%s)", cf->file_path);
cf->file_status == FILE_UNKNOWN) {
cf->file_status = FILE_SKIP;
} else if (reset_tag) {
- (void)xsnprintf(fpath, MAXPATHLEN, "%s/%s",
+ (void)xsnprintf(fpath, PATH_MAX, "%s/%s",
cf->file_path, CVS_PATH_TAG);
(void)unlink(fpath);
} else {
void
cvs_backup_file(struct cvs_file *cf)
{
- char backup_name[MAXPATHLEN];
+ char backup_name[PATH_MAX];
char revstr[RCSNUM_MAXSTR];
if (cf->file_status == FILE_ADDED)
else
rcsnum_tostr(cf->file_ent->ce_rev, revstr, sizeof(revstr));
- (void)xsnprintf(backup_name, MAXPATHLEN, "%s/.#%s.%s",
+ (void)xsnprintf(backup_name, PATH_MAX, "%s/.#%s.%s",
cf->file_wd, cf->file_name, revstr);
cvs_file_copy(cf->file_path, backup_name);
- (void)xsnprintf(backup_name, MAXPATHLEN, ".#%s.%s",
+ (void)xsnprintf(backup_name, PATH_MAX, ".#%s.%s",
cf->file_name, revstr);
cvs_printf("(Locally modified %s moved to %s)\n",
cf->file_name, backup_name);
-/* $OpenBSD: util.c,v 1.156 2014/12/01 21:58:46 deraadt Exp $ */
+/* $OpenBSD: util.c,v 1.157 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org>
DIR *dirp;
struct dirent *ent;
struct stat st;
- char fpath[MAXPATHLEN];
+ char fpath[PATH_MAX];
if (cvs_server_active == 0)
cvs_log(LP_TRACE, "cvs_rmdir(%s)", path);
void
cvs_get_repository_path(const char *dir, char *dst, size_t len)
{
- char buf[MAXPATHLEN];
+ char buf[PATH_MAX];
cvs_get_repository_name(dir, buf, sizeof(buf));
(void)xsnprintf(dst, len, "%s/%s", current_cvsroot->cr_dir, buf);
cvs_get_repository_name(const char *dir, char *dst, size_t len)
{
FILE *fp;
- char fpath[MAXPATHLEN];
+ char fpath[PATH_MAX];
dst[0] = '\0';
{
FILE *fp;
int fd;
- char buf[MAXPATHLEN];
+ char buf[PATH_MAX];
struct hash_data *hdata, hd;
hdata = hash_table_find(&created_cvs_directories, path, strlen(path));
FILE *fp;
size_t len;
struct hash_data *hdata, hd;
- char *entry, *sp, *dp, *dir, *p, rpath[MAXPATHLEN], repo[MAXPATHLEN];
+ char *entry, *sp, *dp, *dir, *p, rpath[PATH_MAX], repo[PATH_MAX];
hdata = hash_table_find(&created_directories, path, strlen(path));
if (hdata != NULL)
cvs_mkdir(const char *path, mode_t mode)
{
size_t len;
- char *sp, *dp, *dir, rpath[MAXPATHLEN];
+ char *sp, *dp, *dir, rpath[PATH_MAX];
if (current_cvsroot->cr_method != CVS_METHOD_LOCAL ||
cvs_server_active == 1)
-/* $OpenBSD: worklist.h,v 1.7 2010/07/23 08:31:19 ray Exp $ */
+/* $OpenBSD: worklist.h,v 1.8 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* All rights reserved.
#ifndef WORKLIST_H
#define WORKLIST_H
-#include <sys/param.h>
+#include <sys/types.h>
+#include <limits.h>
struct worklist {
- char wkl_path[MAXPATHLEN];
+ char wkl_path[PATH_MAX];
volatile SLIST_ENTRY(worklist) wkl_list;
};
-/* $OpenBSD: diff.c,v 1.57 2010/07/16 23:27:58 ray Exp $ */
+/* $OpenBSD: diff.c,v 1.58 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com>
* Materiel Command, USAF, under agreement number F39502-99-1-0512.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <ctype.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "diff.h"
#include "xmalloc.h"
-/* $OpenBSD: diffdir.c,v 1.42 2014/05/20 01:25:23 guenther Exp $ */
+/* $OpenBSD: diffdir.c,v 1.43 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 2003, 2010 Todd C. Miller <Todd.Miller@courtesan.com>
* Materiel Command, USAF, under agreement number F39502-99-1-0512.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <dirent.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "diff.h"
#include "xmalloc.h"
struct dirent *dent1, **dp1, **edp1, **dirp1 = NULL;
struct dirent *dent2, **dp2, **edp2, **dirp2 = NULL;
size_t dirlen1, dirlen2;
- char path1[MAXPATHLEN], path2[MAXPATHLEN];
+ char path1[PATH_MAX], path2[PATH_MAX];
int pos;
dirlen1 = strlcpy(path1, *p1 ? p1 : ".", sizeof(path1));
int flags)
{
flags |= D_HEADER;
- strlcpy(path1 + plen1, dp->d_name, MAXPATHLEN - plen1);
+ strlcpy(path1 + plen1, dp->d_name, PATH_MAX - plen1);
if (stat(path1, &stb1) != 0) {
if (!(Nflag || Pflag) || errno != ENOENT) {
warn("%s", path1);
memset(&stb1, 0, sizeof(stb1));
}
- strlcpy(path2 + plen2, dp->d_name, MAXPATHLEN - plen2);
+ strlcpy(path2 + plen2, dp->d_name, PATH_MAX - plen2);
if (stat(path2, &stb2) != 0) {
if (!Nflag || errno != ENOENT) {
warn("%s", path2);
-/* $OpenBSD: diffreg.c,v 1.83 2014/08/27 15:22:40 kspillner Exp $ */
+/* $OpenBSD: diffreg.c,v 1.84 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
* @(#)diffreg.c 8.1 (Berkeley) 6/6/93
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "diff.h"
#include "pathnames.h"
#include "xmalloc.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
/*
* diff - compare two files.
*/
static FILE *
opentemp(const char *file)
{
- char buf[BUFSIZ], *tempdir, tempfile[MAXPATHLEN];
+ char buf[BUFSIZ], *tempdir, tempfile[PATH_MAX];
ssize_t nread;
int ifd, ofd;
bound = UINT_MAX;
else {
sq = isqrt(n);
- bound = MAX(256, sq);
+ bound = MAXIMUM(256, sq);
}
k = 0;
return;
b = d = 0; /* gcc */
- lowa = MAX(1, cvp->a - diff_context);
- upb = MIN(len[0], context_vec_ptr->b + diff_context);
- lowc = MAX(1, cvp->c - diff_context);
- upd = MIN(len[1], context_vec_ptr->d + diff_context);
+ lowa = MAXIMUM(1, cvp->a - diff_context);
+ upb = MINIMUM(len[0], context_vec_ptr->b + diff_context);
+ lowc = MAXIMUM(1, cvp->c - diff_context);
+ upd = MINIMUM(len[1], context_vec_ptr->d + diff_context);
diff_output("***************");
if ((flags & D_PROTOTYPE)) {
return;
b = d = 0; /* gcc */
- lowa = MAX(1, cvp->a - diff_context);
- upb = MIN(len[0], context_vec_ptr->b + diff_context);
- lowc = MAX(1, cvp->c - diff_context);
- upd = MIN(len[1], context_vec_ptr->d + diff_context);
+ lowa = MAXIMUM(1, cvp->a - diff_context);
+ upb = MINIMUM(len[0], context_vec_ptr->b + diff_context);
+ lowc = MAXIMUM(1, cvp->c - diff_context);
+ upd = MINIMUM(len[1], context_vec_ptr->d + diff_context);
diff_output("@@ -");
uni_range(lowa, upb);
-/* $OpenBSD: function.c,v 1.41 2014/05/18 08:10:00 espie Exp $ */
+/* $OpenBSD: function.c,v 1.42 2015/01/16 06:40:07 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993
* SUCH DAMAGE.
*/
-#include <sys/param.h>
-#include <sys/ucred.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/mount.h>
for (p = *argv; *p; ++p)
if (p[0] == '{' && p[1] == '}') {
new->e_argv[cnt] =
- emalloc((u_int)MAXPATHLEN);
- new->e_len[cnt] = MAXPATHLEN;
+ emalloc((u_int)PATH_MAX);
+ new->e_len[cnt] = PATH_MAX;
break;
}
if (!*p) {
int cnt;
pid_t pid;
int status, fd;
- char base[MAXPATHLEN];
+ char base[PATH_MAX];
/* fts(3) does not chdir for the root level so we do it ourselves. */
if (entry->fts_level == FTS_ROOTLEVEL) {
new->e_orig[cnt] = *argv;
for (p = *argv; *p; ++p)
if (p[0] == '{' && p[1] == '}') {
- new->e_argv[cnt] = emalloc((u_int)MAXPATHLEN);
- new->e_len[cnt] = MAXPATHLEN;
+ new->e_argv[cnt] = emalloc((u_int)PATH_MAX);
+ new->e_len[cnt] = PATH_MAX;
break;
}
if (!*p) {
-/* $OpenBSD: ls.c,v 1.15 2014/01/10 04:53:35 guenther Exp $ */
+/* $OpenBSD: ls.c,v 1.16 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 1989, 1993
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <err.h>
#include <time.h>
#include <tzfile.h>
#include <unistd.h>
+#include <limits.h>
#include <utmp.h>
#include <pwd.h>
#include <grp.h>
printlink(char *name)
{
int lnklen;
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
if ((lnklen = readlink(name, path, sizeof(path) - 1)) == -1) {
warn("%s", name);
-/* $OpenBSD: finger.c,v 1.18 2009/11/12 15:33:21 nicm Exp $ */
+/* $OpenBSD: finger.c,v 1.19 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
* well as home directory, shell, mail info, and .plan/.project files.
*/
-#include <sys/param.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include <err.h>
#include "finger.h"
#include "extern.h"
extern int optind;
extern char *__progname;
int ch;
- char domain[MAXHOSTNAMELEN];
+ char domain[HOST_NAME_MAX+1];
struct stat sb;
oflag = 1; /* default to old "office" behavior */
-/* $OpenBSD: net.c,v 1.12 2009/10/27 23:59:38 deraadt Exp $ */
+/* $OpenBSD: net.c,v 1.13 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-/* $OpenBSD: util.c,v 1.29 2014/11/19 22:07:13 millert Exp $ */
+/* $OpenBSD: util.c,v 1.30 2015/01/16 06:40:07 deraadt Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
#include <sys/types.h>
#include <sys/uio.h>
-#include <sys/param.h>
#include <sys/stat.h>
#include <err.h>
#include <stdio.h>
-/* $OpenBSD: from.c,v 1.16 2013/11/27 13:32:02 okan Exp $ */
+/* $OpenBSD: from.c,v 1.17 2015/01/16 06:40:07 deraadt Exp $ */
/* $NetBSD: from.c,v 1.6 1995/09/01 01:39:10 jtc Exp $ */
/*
struct passwd *pwd;
int ch, newline;
char *file, *sender, *p;
-#if MAXPATHLEN > BUFSIZ
- char buf[MAXPATHLEN];
+#if PATH_MAX > BUFSIZ
+ char buf[PATH_MAX];
#else
char buf[BUFSIZ];
#endif
-/* $OpenBSD: fstat.c,v 1.79 2014/08/20 11:23:42 mikeb Exp $ */
+/* $OpenBSD: fstat.c,v 1.80 2015/01/16 06:40:08 deraadt Exp $ */
/*
* Copyright (c) 2009 Todd C. Miller <Todd.Miller@courtesan.com>
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/queue.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include "fstat.h"
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
struct fileargs fileargs = SLIST_HEAD_INITIALIZER(fileargs);
int fsflg; /* show files on same filesystem as file(s) argument */
* same visible addr. (it's the higher address because when the other
* end closes, it becomes 0)
*/
- maxaddr = (void *)(uintptr_t)MAX(kf->f_data, kf->pipe_peer);
+ maxaddr = (void *)(uintptr_t)MAXIMUM(kf->f_data, kf->pipe_peer);
printf("pipe ");
hide(maxaddr);
-/* $OpenBSD: fuser.c,v 1.5 2014/10/26 06:03:24 guenther Exp $ */
+/* $OpenBSD: fuser.c,v 1.6 2015/01/16 06:40:08 deraadt Exp $ */
/*
* Copyright (c) 2009 Todd C. Miller <Todd.Miller@courtesan.com>
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/stat.h>
#include <sys/sysctl.h>
-/* $OpenBSD: cmds.c,v 1.72 2014/08/16 07:49:27 deraadt Exp $ */
+/* $OpenBSD: cmds.c,v 1.73 2015/01/16 06:40:08 deraadt Exp $ */
/* $NetBSD: cmds.c,v 1.27 1997/08/18 10:20:15 lukem Exp $ */
/*
oldintr = signal(SIGINT, mabort);
(void)setjmp(jabort);
if (proxy) {
- char *cp, *tp2, tmpbuf[MAXPATHLEN];
+ char *cp, *tp2, tmpbuf[PATH_MAX];
while ((cp = remglob(argv, 0, NULL)) != NULL) {
if (*cp == '\0') {
void
setgate(int argc, char *argv[])
{
- static char gsbuf[MAXHOSTNAMELEN];
+ static char gsbuf[HOST_NAME_MAX+1];
if (argc > 3) {
fprintf(ttyout, "usage: %s [on | off | host [port]]\n",
void
lcd(int argc, char *argv[])
{
- char buf[MAXPATHLEN];
+ char buf[PATH_MAX];
char *oldargv1;
if (argc < 2)
{
pid_t pid;
sig_t old1, old2;
- char shellnam[MAXPATHLEN], *shellp, *namep;
+ char shellnam[PATH_MAX], *shellp, *namep;
int wait_status;
old1 = signal (SIGINT, SIG_IGN);
void
lpwd(int argc, char *argv[])
{
- char buf[MAXPATHLEN];
+ char buf[PATH_MAX];
if (getcwd(buf, sizeof(buf)) != NULL)
fprintf(ttyout, "Local directory %s\n", buf);
cp = strchr(altarg, ' ');
}
*cp = '\0';
- (void)strncpy(mapin, altarg, MAXPATHLEN - 1);
+ (void)strncpy(mapin, altarg, PATH_MAX - 1);
while (*++cp == ' ')
continue;
- (void)strncpy(mapout, cp, MAXPATHLEN - 1);
+ (void)strncpy(mapout, cp, PATH_MAX - 1);
}
void
-/* $OpenBSD: complete.c,v 1.27 2014/04/23 11:47:04 jca Exp $ */
+/* $OpenBSD: complete.c,v 1.28 2015/01/16 06:40:08 deraadt Exp $ */
/* $NetBSD: complete.c,v 1.10 1997/08/18 10:20:18 lukem Exp $ */
/*-
static unsigned char
complete_ambiguous(char *word, int list, StringList *words)
{
- char insertstr[MAXPATHLEN * 2];
+ char insertstr[PATH_MAX * 2];
char *lastmatch;
int i, j;
size_t matchlen, wordlen;
complete_local(char *word, int list)
{
StringList *words;
- char dir[MAXPATHLEN];
+ char dir[PATH_MAX];
char *file;
DIR *dd;
struct dirent *dp;
complete_remote(char *word, int list)
{
static StringList *dirlist;
- static char lastdir[MAXPATHLEN];
+ static char lastdir[PATH_MAX];
StringList *words;
- char dir[MAXPATHLEN];
+ char dir[PATH_MAX];
char *file, *cp;
int i;
unsigned char rv;
-/* $OpenBSD: fetch.c,v 1.136 2015/01/12 15:46:55 bluhm Exp $ */
+/* $OpenBSD: fetch.c,v 1.137 2015/01/16 06:40:08 deraadt Exp $ */
/* $NetBSD: fetch.c,v 1.14 1997/08/18 10:20:20 lukem Exp $ */
/*-
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <ctype.h>
#include <err.h>
#include <libgen.h>
-#include <limits.h>
#include <netdb.h>
#include <fcntl.h>
#include <signal.h>
int rval, xargc;
volatile int argpos;
int dirhasglob, filehasglob, oautologin;
- char rempath[MAXPATHLEN];
+ char rempath[PATH_MAX];
argpos = 0;
-/* $OpenBSD: ftp.c,v 1.88 2014/10/24 02:01:20 lteo Exp $ */
+/* $OpenBSD: ftp.c,v 1.89 2015/01/16 06:40:08 deraadt Exp $ */
/* $NetBSD: ftp.c,v 1.27 1997/08/18 10:20:23 lukem Exp $ */
/*
hookup(char *host, char *port)
{
int s, tos, error;
- static char hostnamebuf[MAXHOSTNAMELEN];
+ static char hostnamebuf[HOST_NAME_MAX+1];
struct addrinfo hints, *res, *res0, *ares;
char hbuf[NI_MAXHOST];
char *cause = "unknown";
sig_t oldintr;
static struct comvars {
int connect;
- char name[MAXHOSTNAMELEN];
+ char name[HOST_NAME_MAX+1];
union sockunion mctl;
union sockunion hctl;
FILE *in;
char nti[17];
char nto[17];
int mapflg;
- char mi[MAXPATHLEN];
- char mo[MAXPATHLEN];
+ char mi[PATH_MAX];
+ char mo[PATH_MAX];
} proxstruct, tmpstruct;
struct comvars *ip, *op;
char *
gunique(const char *local)
{
- static char new[MAXPATHLEN];
+ static char new[PATH_MAX];
char *cp = strrchr(local, '/');
int d, count=0;
char ext = '1';
-/* $OpenBSD: ftp_var.h,v 1.36 2014/10/31 13:48:21 jsing Exp $ */
+/* $OpenBSD: ftp_var.h,v 1.37 2015/01/16 06:40:08 deraadt Exp $ */
/* $NetBSD: ftp_var.h,v 1.18 1997/08/18 10:20:25 lukem Exp $ */
/*
* FTP global variables.
*/
-#include <sys/param.h>
+#include <sys/signal.h>
+#include <limits.h>
#include <setjmp.h>
#ifndef SMALL
#include "small.h"
#define HASHBYTES 1024
-#define FTPBUFLEN MAXPATHLEN + 200
+#define FTPBUFLEN PATH_MAX + 200
#define STALLTIME 5 /* # of seconds of no xfer before "stalling" */
int activefallback; /* fall back to active mode if passive fails */
char ntin[17]; /* input translation table */
char ntout[17]; /* output translation table */
-char mapin[MAXPATHLEN]; /* input map template */
-char mapout[MAXPATHLEN]; /* output map template */
+char mapin[PATH_MAX]; /* input map template */
+char mapout[PATH_MAX]; /* output map template */
char typename[32]; /* name of file transfer type */
int type; /* requested file transfer type */
int curtype; /* current file transfer type */
-/* $OpenBSD: main.c,v 1.95 2014/10/31 13:48:21 jsing Exp $ */
+/* $OpenBSD: main.c,v 1.96 2015/01/16 06:40:08 deraadt Exp $ */
/* $NetBSD: main.c,v 1.24 1997/08/18 10:20:26 lukem Exp $ */
/*
#include <ctype.h>
#include <err.h>
-#include <limits.h>
#include <netdb.h>
#include <pwd.h>
#include <stdio.h>
{
int ch, top, rval;
struct passwd *pw = NULL;
- char *cp, homedir[MAXPATHLEN];
+ char *cp, homedir[PATH_MAX];
char *outfile = NULL;
const char *errstr;
int dumb_terminal = 0;
-/* $OpenBSD: ruserpass.c,v 1.29 2014/05/20 01:25:23 guenther Exp $ */
+/* $OpenBSD: ruserpass.c,v 1.30 2015/01/16 06:40:08 deraadt Exp $ */
/* $NetBSD: ruserpass.c,v 1.14 1997/07/20 09:46:01 lukem Exp $ */
/*
int
ruserpass(const char *host, char **aname, char **apass, char **aacct)
{
- char *hdir, buf[MAXPATHLEN], *tmp;
- char myname[MAXHOSTNAMELEN], *mydomain;
+ char *hdir, buf[PATH_MAX], *tmp;
+ char myname[HOST_NAME_MAX+1], *mydomain;
int t, i, c, usedefault = 0;
struct stat stb;
-/* $OpenBSD: small.c,v 1.2 2014/08/16 07:49:27 deraadt Exp $ */
+/* $OpenBSD: small.c,v 1.3 2015/01/16 06:40:08 deraadt Exp $ */
/* $NetBSD: cmds.c,v 1.27 1997/08/18 10:20:15 lukem Exp $ */
/*
}
globargv2 = argv[2];
if (loc && mcase) {
- char *tp = argv[1], *tp2, tmpbuf[MAXPATHLEN];
+ char *tp = argv[1], *tp2, tmpbuf[PATH_MAX];
while (*tp && !islower(*tp)) {
tp++;
extern int optind, optreset;
sig_t oldintr;
int ch, xargc = 2;
- char *cp, localcwd[MAXPATHLEN], *xargv[] = { argv[0], NULL, NULL };
+ char *cp, localcwd[PATH_MAX], *xargv[] = { argv[0], NULL, NULL };
static int restartit = 0;
#ifndef SMALL
extern char *optarg;
char *
dotrans(char *name)
{
- static char new[MAXPATHLEN];
+ static char new[PATH_MAX];
char *cp1, *cp2 = new;
int i, ostop, found;
char *
domap(char *name)
{
- static char new[MAXPATHLEN];
+ static char new[PATH_MAX];
char *cp1 = name, *cp2 = mapin;
char *tp[9], *te[9];
int i, toks[9], toknum = 0, match = 1;
-/* $OpenBSD: util.c,v 1.67 2014/08/16 07:49:27 deraadt Exp $ */
+/* $OpenBSD: util.c,v 1.68 2015/01/16 06:40:08 deraadt Exp $ */
/* $NetBSD: util.c,v 1.12 1997/08/18 10:20:27 lukem Exp $ */
/*-
/*
* FTP User Program -- Misc support routines
*/
+#include <sys/param.h> /* BSD */
#include <sys/ioctl.h>
#include <sys/time.h>
#include <arpa/ftp.h>
#include <errno.h>
#include <fcntl.h>
#include <libgen.h>
-#include <limits.h>
#include <glob.h>
#include <pwd.h>
#include <signal.h>
#include "ftp_var.h"
#include "pathnames.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
static void updateprogressmeter(int);
/*
int
ftp_login(const char *host, char *user, char *pass)
{
- char tmp[80], *acctname = NULL, host_name[MAXHOSTNAMELEN];
- char anonpass[MAXLOGNAME + 1 + MAXHOSTNAMELEN]; /* "user@hostname" */
+ char tmp[80], *acctname = NULL, host_name[HOST_NAME_MAX+1];
+ char anonpass[LOGIN_NAME_MAX + 1 + HOST_NAME_MAX+1]; /* "user@hostname" */
int n, aflag = 0, retry = 0;
struct passwd *pw;
char *
remglob2(char *argv[], int doswitch, char **errbuf, FILE **ftemp, char *type)
{
- char temp[MAXPATHLEN], *bufp, *cp, *lmode;
- static char buf[MAXPATHLEN], **args;
+ char temp[PATH_MAX], *bufp, *cp, *lmode;
+ static char buf[PATH_MAX], **args;
int oldverbose, oldhash, fd;
if (!mflag) {
int
fileindir(const char *file, const char *dir)
{
- char parentdirbuf[MAXPATHLEN], *parentdir;
- char realdir[MAXPATHLEN];
+ char parentdirbuf[PATH_MAX], *parentdir;
+ char realdir[PATH_MAX];
size_t dirlen;
/* determine parent directory of file */
ratio = cursize * 100 / filesize;
else
ratio = 100;
- ratio = MAX(ratio, 0);
- ratio = MIN(ratio, 100);
+ ratio = MAXIMUM(ratio, 0);
+ ratio = MINIMUM(ratio, 100);
if (!verbose && flag == -1) {
filename = basename(filename);
if (filename != NULL)
-/* $OpenBSD: getent.c,v 1.8 2014/10/24 10:23:32 schwarze Exp $ */
+/* $OpenBSD: getent.c,v 1.9 2015/01/16 06:40:08 deraadt Exp $ */
/* $NetBSD: getent.c,v 1.7 2005/08/24 14:31:02 ginsbach Exp $ */
/*-
static int
ethers(int argc, char *argv[])
{
- char hostname[MAXHOSTNAMELEN], *hp;
+ char hostname[HOST_NAME_MAX+1], *hp;
int i, rv = RV_OK;
struct ether_addr ea, *eap;
-/* $OpenBSD: hertz.c,v 1.6 2006/03/25 19:06:36 espie Exp $ */
+/* $OpenBSD: hertz.c,v 1.7 2015/01/16 06:40:08 deraadt Exp $ */
/*
* Copyright (c) 2005 Artur Grabowski <art@openbsd.org>
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/sysctl.h>
-/* $OpenBSD: file.c,v 1.11 2010/07/02 20:48:48 nicm Exp $ */
+/* $OpenBSD: file.c,v 1.12 2015/01/16 06:40:08 deraadt Exp $ */
/*-
* Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
* SUCH DAMAGE.
*/
-#include <sys/param.h>
-
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
+#include <limits.h>
#include <zlib.h>
#include "grep.h"
-static char fname[MAXPATHLEN];
+static char fname[PATH_MAX];
#ifndef NOZ
static char *lnbuf;
static size_t lnbuflen;
-/* $OpenBSD: mmfile.c,v 1.15 2014/11/08 22:13:47 brad Exp $ */
+/* $OpenBSD: mmfile.c,v 1.16 2015/01/16 06:40:08 deraadt Exp $ */
/*-
* Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/mman.h>
#include <sys/stat.h>
-/* $OpenBSD: queue.c,v 1.6 2011/07/08 01:20:24 tedu Exp $ */
+/* $OpenBSD: queue.c,v 1.7 2015/01/16 06:40:08 deraadt Exp $ */
/*-
* Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
* Dodge.
*/
-#include <sys/param.h>
-
#include <stdlib.h>
#include <string.h>
-/* $OpenBSD: display.c,v 1.20 2010/10/22 14:04:24 millert Exp $ */
+/* $OpenBSD: display.c,v 1.21 2015/01/16 06:40:08 deraadt Exp $ */
/* $NetBSD: display.c,v 1.12 2001/12/07 15:14:29 bjh21 Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <ctype.h>
#include "hexdump.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
enum _vflag vflag = FIRST;
static off_t address; /* address/offset in stream */
return(curp);
}
n = fread((char *)curp + nread, sizeof(u_char),
- length == -1 ? need : MIN(length, need), stdin);
+ length == -1 ? need : MINIMUM(length, need), stdin);
if (!n) {
if (ferror(stdin))
warn("%s", _argv[-1]);
-/* $OpenBSD: hexdump.c,v 1.16 2011/09/22 09:09:42 stsp Exp $ */
+/* $OpenBSD: hexdump.c,v 1.17 2015/01/16 06:40:08 deraadt Exp $ */
/* $NetBSD: hexdump.c,v 1.7 1997/10/19 02:34:06 lukem Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "hexdump.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
FS *fshead; /* head of format strings */
int blocksize; /* data block size */
int exitval; /* final exit value */
blocksize = tfs->bcnt;
}
if (length != -1) {
- iobufsiz = MIN(length, blocksize);
+ iobufsiz = MINIMUM(length, blocksize);
if ((iobuf = malloc(iobufsiz)) == NULL)
err(1, NULL);
}
-/* $OpenBSD: id.c,v 1.21 2014/07/14 05:41:00 guenther Exp $ */
+/* $OpenBSD: id.c,v 1.22 2015/01/16 06:40:08 deraadt Exp $ */
/*-
* Copyright (c) 1991, 1993
* SUCH DAMAGE.
*/
-#include <sys/param.h>
-
#include <err.h>
#include <errno.h>
#include <grp.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
void current(void);
void pretty(struct passwd *);
struct passwd *pw;
int cnt, ngroups;
uid_t uid, euid;
- gid_t groups[NGROUPS], gid, egid, lastgid;
+ gid_t groups[NGROUPS_MAX], gid, egid, lastgid;
char *prefix;
uid = getuid();
if ((gr = getgrgid(egid)))
(void)printf("(%s)", gr->gr_name);
}
- if ((ngroups = getgroups(NGROUPS, groups))) {
+ if ((ngroups = getgroups(NGROUPS_MAX, groups))) {
for (prefix = " groups=", lastgid = (gid_t)-1, cnt = 0;
cnt < ngroups; prefix = ", ", lastgid = gid) {
gid = groups[cnt++];
void
user(struct passwd *pw)
{
- gid_t gid, groups[NGROUPS + 1];
+ gid_t gid, groups[NGROUPS_MAX + 1];
int cnt, ngroups;
uid_t uid;
struct group *gr;
(void)printf(" gid=%u", pw->pw_gid);
if ((gr = getgrgid(pw->pw_gid)))
(void)printf("(%s)", gr->gr_name);
- ngroups = NGROUPS + 1;
+ ngroups = NGROUPS_MAX + 1;
(void) getgrouplist(pw->pw_name, pw->pw_gid, groups, &ngroups);
prefix = " groups=";
for (cnt = 0; cnt < ngroups;) {
group(struct passwd *pw, int nflag)
{
int cnt, ngroups;
- gid_t gid, groups[NGROUPS + 1];
+ gid_t gid, groups[NGROUPS_MAX + 1];
struct group *gr;
char *prefix;
if (pw) {
- ngroups = NGROUPS + 1;
+ ngroups = NGROUPS_MAX + 1;
(void) getgrouplist(pw->pw_name, pw->pw_gid, groups, &ngroups);
} else {
groups[0] = getgid();
- ngroups = getgroups(NGROUPS, groups + 1) + 1;
+ ngroups = getgroups(NGROUPS_MAX, groups + 1) + 1;
}
prefix = "";
for (cnt = 0; cnt < ngroups;) {
-/* $OpenBSD: indent.c,v 1.25 2014/07/20 01:38:40 guenther Exp $ */
+/* $OpenBSD: indent.c,v 1.26 2015/01/16 06:40:08 deraadt Exp $ */
/*
* Copyright (c) 1980, 1993
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <fcntl.h>
#include <unistd.h>
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
* file */
char *out_name = "Standard Output"; /* will always point to name
* of output file */
-char bakfile[MAXPATHLEN] = "";
+char bakfile[PATH_MAX] = "";
void bakcopy(void);
p--;
if (*p == '/')
p++;
- if (snprintf(bakfile, MAXPATHLEN, "%s.BAK", p) >= MAXPATHLEN)
+ if (snprintf(bakfile, PATH_MAX, "%s.BAK", p) >= PATH_MAX)
errc(1, ENAMETOOLONG, "%s.BAK", p);
/* copy in_name to backup file */
-/* $OpenBSD: ipcs.c,v 1.25 2012/02/05 18:27:03 guenther Exp $ */
+/* $OpenBSD: ipcs.c,v 1.26 2015/01/16 06:40:08 deraadt Exp $ */
/* $NetBSD: ipcs.c,v 1.25 2000/06/16 03:58:20 simonb Exp $ */
/*-
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/sysctl.h>
#define _KERNEL /* XXX */
#include <sys/ipc.h>
-/* $OpenBSD: join.c,v 1.23 2014/10/11 04:31:55 doug Exp $ */
+/* $OpenBSD: join.c,v 1.24 2015/01/16 06:40:08 deraadt Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
* SUCH DAMAGE.
*/
-#include <sys/param.h>
-
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
/*
* There's a structure per input file which encapsulates the state of the
* file. We repeatedly read lines from each file until we've read in all
if (lp->linealloc <= len + 1) {
char *p;
u_long newsize = lp->linealloc +
- MAX(100, len + 1 - lp->linealloc);
+ MAXIMUM(100, len + 1 - lp->linealloc);
if ((p = realloc(lp->line, newsize)) == NULL)
err(1, NULL);
lp->line = p;
-/* $OpenBSD: kdump.c,v 1.96 2014/12/28 11:11:01 bluhm Exp $ */
+/* $OpenBSD: kdump.c,v 1.97 2015/01/16 06:40:09 deraadt Exp $ */
/*-
* Copyright (c) 1988, 1993
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXCOMLEN nitems */
#include <sys/time.h>
+#include <sys/signal.h>
#include <sys/uio.h>
#include <sys/ktrace.h>
#include <sys/ioctl.h>
-/* $OpenBSD: ktrace.c,v 1.30 2014/05/24 17:04:16 deraadt Exp $ */
+/* $OpenBSD: ktrace.c,v 1.31 2015/01/16 06:40:09 deraadt Exp $ */
/* $NetBSD: ktrace.c,v 1.4 1995/08/31 23:01:44 jtc Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXCOMLEN */
+#include <sys/signal.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/uio.h>
-/* $OpenBSD: subr.c,v 1.8 2013/06/01 09:51:28 miod Exp $ */
+/* $OpenBSD: subr.c,v 1.9 2015/01/16 06:40:09 deraadt Exp $ */
/* $NetBSD: subr.c,v 1.6 1995/08/31 23:01:45 jtc Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXCOMLEN */
#include <sys/file.h>
#include <sys/user.h>
#include <sys/proc.h>
-/* $OpenBSD: lam.c,v 1.16 2013/11/20 21:22:17 deraadt Exp $ */
+/* $OpenBSD: lam.c,v 1.17 2015/01/16 06:40:09 deraadt Exp $ */
/* $NetBSD: lam.c,v 1.2 1994/11/14 20:27:42 jtc Exp $ */
/*-
* Author: John Kunze, UCB
*/
-#include <sys/param.h>
+#include <sys/param.h> /* NOFILE_MAX */
#include <ctype.h>
#include <err.h>
-/* $OpenBSD: last.c,v 1.44 2014/12/09 15:40:23 tedu Exp $ */
+/* $OpenBSD: last.c,v 1.45 2015/01/16 06:40:09 deraadt Exp $ */
/* $NetBSD: last.c,v 1.6 1994/12/24 16:49:02 cgd Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <ctype.h>
#include <time.h>
#include <tzfile.h>
#include <unistd.h>
+#include <limits.h>
#include <utmp.h>
#define NO 0 /* false/no */
void
hostconv(char *arg)
{
- static char *hostdot, name[MAXHOSTNAMELEN];
+ static char *hostdot, name[HOST_NAME_MAX+1];
static int first = 1;
char *argdot;
-/* $OpenBSD: lastcomm.c,v 1.19 2013/11/27 13:32:02 okan Exp $ */
+/* $OpenBSD: lastcomm.c,v 1.20 2015/01/16 06:40:09 deraadt Exp $ */
/* $NetBSD: lastcomm.c,v 1.9 1995/10/22 01:43:42 ghudson Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* NODEV */
#include <sys/stat.h>
#include <sys/acct.h>
-/* $OpenBSD: leave.c,v 1.14 2014/11/26 18:34:51 millert Exp $ */
+/* $OpenBSD: leave.c,v 1.15 2015/01/16 06:40:09 deraadt Exp $ */
/* $NetBSD: leave.c,v 1.4 1995/07/03 16:50:13 phil Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <ctype.h>
#include <err.h>
-/* $OpenBSD: lndir.c,v 1.20 2014/05/20 01:25:23 guenther Exp $ */
+/* $OpenBSD: lndir.c,v 1.21 2015/01/16 06:40:09 deraadt Exp $ */
/* $XConsortium: lndir.c /main/15 1995/08/30 10:56:18 gildea $ */
/*
% lndir ../X
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <dirent.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
extern char *__progname;
int
dodir(char *fn, struct stat *fs, struct stat *ts, int rel)
{
- char buf[MAXPATHLEN + 1], symbuf[MAXPATHLEN + 1];
- char basesym[MAXPATHLEN + 1];
+ char buf[PATH_MAX + 1], symbuf[PATH_MAX + 1];
+ char basesym[PATH_MAX + 1];
int n_dirs, symlen, basesymlen = -1;
struct stat sb, sc;
struct except *cur;
/*
- * $OpenBSD: locate.bigram.c,v 1.12 2009/10/27 23:59:39 deraadt Exp $
+ * $OpenBSD: locate.bigram.c,v 1.13 2015/01/16 06:40:09 deraadt Exp $
*
* Copyright (c) 1995 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
* Copyright (c) 1989, 1993
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: locate.bigram.c,v 1.12 2009/10/27 23:59:39 deraadt Exp $
+ * $Id: locate.bigram.c,v 1.13 2015/01/16 06:40:09 deraadt Exp $
*/
/*
#include <stdio.h>
#include <stdlib.h>
-#include <sys/param.h> /* for MAXPATHLEN */
+#include <limits.h>
#include "locate.h"
-u_char buf1[MAXPATHLEN] = " ";
-u_char buf2[MAXPATHLEN];
+u_char buf1[PATH_MAX] = " ";
+u_char buf2[PATH_MAX];
u_int bigram[UCHAR_MAX + 1][UCHAR_MAX + 1];
int
/*
- * $OpenBSD: locate.code.c,v 1.17 2013/11/17 20:19:36 okan Exp $
+ * $OpenBSD: locate.code.c,v 1.18 2015/01/16 06:40:09 deraadt Exp $
*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: locate.code.c,v 1.17 2013/11/17 20:19:36 okan Exp $
+ * $Id: locate.code.c,v 1.18 2015/01/16 06:40:09 deraadt Exp $
*/
/*
* Wolfram Schneider, Berlin September 1996
*/
-#include <sys/param.h>
-
#include <err.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "locate.h"
#define BGBUFSIZE (NBG * 2) /* size of bigram buffer */
-u_char buf1[MAXPATHLEN] = " ";
-u_char buf2[MAXPATHLEN];
+u_char buf1[PATH_MAX] = " ";
+u_char buf2[PATH_MAX];
u_char bigrams[BGBUFSIZE + 1] = { 0 };
#define LOOKUP 1 /* use a lookup array instead a function, 3x faster */
-/* $OpenBSD: fastfind.c,v 1.11 2010/10/25 19:16:45 millert Exp $ */
+/* $OpenBSD: fastfind.c,v 1.12 2015/01/16 06:40:09 deraadt Exp $ */
/*
* Copyright (c) 1995 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: fastfind.c,v 1.11 2010/10/25 19:16:45 millert Exp $
+ * $Id: fastfind.c,v 1.12 2015/01/16 06:40:09 deraadt Exp $
*/
#ifndef _LOCATE_STATISTIC_
u_char *p, *s;
int c;
int count, umlaut;
- u_char bigram1[NBG], bigram2[NBG], path[MAXPATHLEN];
+ u_char bigram1[NBG], bigram2[NBG], path[PATH_MAX];
for (c = 0, p = bigram1, s = bigram2; c < NBG; c++) {
p[c] = check_bigram_char(getc(fp));
int c, cc;
int count, found, globflag;
u_char *cutoff;
- u_char bigram1[NBG], bigram2[NBG], path[MAXPATHLEN];
+ u_char bigram1[NBG], bigram2[NBG], path[PATH_MAX];
#ifdef FF_ICASE
/* use a lookup table for case insensitive search */
/*
- * $OpenBSD: locate.c,v 1.25 2012/04/13 15:13:07 ajacoutot Exp $
+ * $OpenBSD: locate.c,v 1.26 2015/01/16 06:40:09 deraadt Exp $
*
* Copyright (c) 1995 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
* Copyright (c) 1989, 1993
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: locate.c,v 1.25 2012/04/13 15:13:07 ajacoutot Exp $
+ * $Id: locate.c,v 1.26 2015/01/16 06:40:09 deraadt Exp $
*/
/*
* in the standard 'find'.
*/
-#include <sys/param.h>
#include <ctype.h>
#include <err.h>
#include <fnmatch.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#ifdef MMAP
# include <sys/types.h>
void
sane_count(int count)
{
- if (count < 0 || count >= MAXPATHLEN) {
+ if (count < 0 || count >= PATH_MAX) {
fprintf(stderr, "locate: corrupted database\n");
exit(1);
}
-/* $OpenBSD: util.c,v 1.12 2014/11/16 00:04:53 tedu Exp $
+/* $OpenBSD: util.c,v 1.13 2015/01/16 06:40:09 deraadt Exp $
*
* Copyright (c) 1995 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
* Copyright (c) 1989, 1993
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: util.c,v 1.12 2014/11/16 00:04:53 tedu Exp $
+ * $Id: util.c,v 1.13 2015/01/16 06:40:09 deraadt Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <err.h>
-#include <sys/param.h>
#include <stdio.h>
+#include <limits.h>
#include "locate.h"
i = u.i;
- if (i > MAXPATHLEN || i < -(MAXPATHLEN)) {
+ if (i > PATH_MAX || i < -(PATH_MAX)) {
i = ntohl(i);
- if (i > MAXPATHLEN || i < -(MAXPATHLEN)) {
+ if (i > PATH_MAX || i < -(PATH_MAX)) {
(void)fprintf(stderr,
- "integer out of +-MAXPATHLEN (%d): %d\n",
- MAXPATHLEN, i);
+ "integer out of +-PATH_MAX (%d): %d\n",
+ PATH_MAX, i);
exit(1);
}
}
word = getw(fp);
- if (word > MAXPATHLEN || word < -(MAXPATHLEN)) {
+ if (word > PATH_MAX || word < -(PATH_MAX)) {
word = ntohl(word);
- if (word > MAXPATHLEN || word < -(MAXPATHLEN)) {
+ if (word > PATH_MAX || word < -(PATH_MAX)) {
(void)fprintf(stderr,
- "integer out of +-MAXPATHLEN (%d): %d\n",
- MAXPATHLEN, word);
+ "integer out of +-PATH_MAX (%d): %d\n",
+ PATH_MAX, word);
exit(1);
}
}
-/* $OpenBSD: lock.c,v 1.27 2013/08/22 04:43:40 guenther Exp $ */
+/* $OpenBSD: lock.c,v 1.28 2015/01/16 06:40:09 deraadt Exp $ */
/* $NetBSD: lock.c,v 1.8 1996/05/07 18:32:31 jtc Exp $ */
/*
* an argument of the form -time where time is in minutes
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <signal.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
+#include <limits.h>
#include <login_cap.h>
#include <bsd_auth.h>
int
main(int argc, char *argv[])
{
- char hostname[MAXHOSTNAMELEN], s[BUFSIZ], s1[BUFSIZ], date[256];
+ char hostname[HOST_NAME_MAX+1], s[BUFSIZ], s1[BUFSIZ], date[256];
char *p, *style, *nstyle, *ttynam;
struct itimerval ntimer, otimer;
int ch, sectimeout, usemine, cnt, tries = 10, backoff = 3;
-/* $OpenBSD: failedlogin.c,v 1.16 2013/06/01 21:06:39 deraadt Exp $ */
+/* $OpenBSD: failedlogin.c,v 1.17 2015/01/16 06:40:09 deraadt Exp $ */
/*
* Copyright (c) 1996 Todd C. Miller <Todd.Miller@courtesan.com>
* the last failed login was.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/time.h>
-/* $OpenBSD: login.c,v 1.62 2014/05/20 01:25:23 guenther Exp $ */
+/* $OpenBSD: login.c,v 1.63 2015/01/16 06:40:09 deraadt Exp $ */
/* $NetBSD: login.c,v 1.13 1996/05/15 23:50:16 jtc Exp $ */
/*-
* login -p (preserve existing environment; for getty)
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <ttyent.h>
#include <tzfile.h>
#include <unistd.h>
+#include <limits.h>
#include <utmp.h>
#include <util.h>
#include <bsd_auth.h>
{
char *domain, *p, *ttyn, *shell, *fullname, *instance;
char *lipaddr, *script, *ripaddr, *style, *type, *fqdn;
- char tbuf[MAXPATHLEN + 2], tname[sizeof(_PATH_TTY) + 10];
- char localhost[MAXHOSTNAMELEN], *copyright;
+ char tbuf[PATH_MAX + 2], tname[sizeof(_PATH_TTY) + 10];
+ char localhost[HOST_NAME_MAX+1], *copyright;
char mail[sizeof(_PATH_MAILDIR) + 1 + NAME_MAX];
int ask, ch, cnt, fflag, pflag, quietlog, rootlogin, lastchance;
int error, homeless, needto, authok, tries, backoff;
shell = login_getcapstr(lc, "shell", pwd->pw_shell, pwd->pw_shell);
if (*shell == '\0')
shell = _PATH_BSHELL;
- else if (strlen(shell) >= MAXPATHLEN) {
+ else if (strlen(shell) >= PATH_MAX) {
syslog(LOG_ERR, "shell path too long: %s", shell);
warnx("invalid shell");
quickexit(1);
-/* $OpenBSD: gnum4.c,v 1.46 2014/07/10 14:12:31 espie Exp $ */
+/* $OpenBSD: gnum4.c,v 1.47 2015/01/16 06:40:09 deraadt Exp $ */
/*
* Copyright (c) 1999 Marc Espie
* functions needed to support gnu-m4 extensions, including a fake freezing
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <ctype.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
+#include <limits.h>
#include "mdef.h"
#include "stdd.h"
#include "extern.h"
struct input_file *
dopath(struct input_file *i, const char *filename)
{
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
struct path_entry *pe;
FILE *f;
-/* $OpenBSD: aux.c,v 1.26 2014/01/17 18:42:30 okan Exp $ */
+/* $OpenBSD: aux.c,v 1.27 2015/01/16 06:40:09 deraadt Exp $ */
/* $NetBSD: aux.c,v 1.5 1997/05/13 06:15:52 mikel Exp $ */
/*
FILE *s_file; /* File we were in. */
int s_cond; /* Saved state of conditionals */
int s_loading; /* Loading .mailrc, etc. */
-} sstack[NOFILE];
+} sstack[OPEN_MAX];
/*
* Pushdown current input file and switch to a new one.
warn("%s", cp);
return(1);
}
- if (ssp >= NOFILE - 1) {
+ if (ssp >= OPEN_MAX - 1) {
puts("Too much \"sourcing\" going on.");
(void)Fclose(fi);
return(1);
-/* $OpenBSD: def.h,v 1.13 2003/06/25 15:13:32 millert Exp $ */
+/* $OpenBSD: def.h,v 1.14 2015/01/16 06:40:09 deraadt Exp $ */
/* $NetBSD: def.h,v 1.9 1996/12/28 07:11:00 tls Exp $ */
/*
* SUCH DAMAGE.
*
* @(#)def.h 8.4 (Berkeley) 4/20/95
- * $OpenBSD: def.h,v 1.13 2003/06/25 15:13:32 millert Exp $
+ * $OpenBSD: def.h,v 1.14 2015/01/16 06:40:09 deraadt Exp $
*/
/*
#ifndef MAIL_DEF_H
#define MAIL_DEF_H
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
+#include <limits.h>
#include <vis.h>
#include "pathnames.h"
#define ESCAPE '~' /* Default escape for sending */
#define NMLSIZE 1024 /* max names in a message list */
-#define PATHSIZE MAXPATHLEN /* Size of pathnames throughout */
+#define PATHSIZE PATH_MAX /* Size of pathnames throughout */
#define HSHSIZE 59 /* Hash size for aliases and vars */
#define LINESIZE BUFSIZ /* max readable line width */
#define STRINGSIZE ((unsigned) 128)/* Dynamic allocation units */
-/* $OpenBSD: main.c,v 1.26 2014/12/16 18:37:17 millert Exp $ */
+/* $OpenBSD: main.c,v 1.27 2015/01/16 06:40:09 deraadt Exp $ */
/* $NetBSD: main.c,v 1.7 1997/05/13 06:15:57 mikel Exp $ */
/*
/*
* Next argument is person to pretend to be.
*/
- if (strlen(optarg) >= MAXLOGNAME)
+ if (strlen(optarg) >= LOGIN_NAME_MAX)
errx(1, "username `%s' too long", optarg);
unsetenv("MAIL");
myname = optarg;
-/* $OpenBSD: popen.c,v 1.36 2013/04/29 00:28:23 okan Exp $ */
+/* $OpenBSD: popen.c,v 1.37 2015/01/16 06:40:09 deraadt Exp $ */
/* $NetBSD: popen.c,v 1.6 1997/05/13 06:48:42 mikel Exp $ */
/*
lockfp = NULL;
} else if (action == 1) {
char *cmd;
- char buf[sizeof(_PATH_LOCKSPOOL) + MAXLOGNAME + 1];
+ char buf[sizeof(_PATH_LOCKSPOOL) + LOGIN_NAME_MAX + 1];
/* XXX - lockspool requires root for user arg, we do not */
if (uflag) {
-/* $OpenBSD: man.c,v 1.48 2013/07/01 18:47:39 schwarze Exp $ */
+/* $OpenBSD: man.c,v 1.49 2015/01/16 06:40:09 deraadt Exp $ */
/* $NetBSD: man.c,v 1.7 1995/09/28 06:05:34 tls Exp $ */
/*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/stat.h>
-/* $OpenBSD: if.c,v 1.69 2014/11/21 17:49:00 mikeb Exp $ */
+/* $OpenBSD: if.c,v 1.70 2015/01/16 06:40:09 deraadt Exp $ */
/* $NetBSD: if.c,v 1.16.4.2 1996/06/07 21:46:46 thorpej Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* roundup() */
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/protosw.h>
-/* $OpenBSD: inet.c,v 1.137 2014/11/03 17:20:46 bluhm Exp $ */
+/* $OpenBSD: inet.c,v 1.138 2015/01/16 06:40:09 deraadt Exp $ */
/* $NetBSD: inet.c,v 1.14 1995/10/03 21:42:37 thorpej Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
char *cp;
static char line[50];
struct hostent *hp;
- static char domain[MAXHOSTNAMELEN];
+ static char domain[HOST_NAME_MAX+1];
static int first = 1;
if (first && !nflag) {
-/* $OpenBSD: inet6.c,v 1.46 2014/08/14 12:55:50 mpi Exp $ */
+/* $OpenBSD: inet6.c,v 1.47 2015/01/16 06:40:10 deraadt Exp $ */
/* BSDI inet.c,v 2.3 1995/10/24 02:19:29 prb Exp */
/*
* Copyright (c) 1983, 1988, 1993
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "netstat.h"
struct socket sockb;
char *cp;
static char line[NI_MAXHOST];
struct hostent *hp;
- static char domain[MAXHOSTNAMELEN];
+ static char domain[HOST_NAME_MAX+1];
static int first = 1;
char hbuf[NI_MAXHOST];
struct sockaddr_in6 sin6;
-/* $OpenBSD: main.c,v 1.102 2014/10/23 16:45:57 schwarze Exp $ */
+/* $OpenBSD: main.c,v 1.103 2015/01/16 06:40:10 deraadt Exp $ */
/* $NetBSD: main.c,v 1.9 1996/05/07 02:55:02 thorpej Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/protosw.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
-/* $OpenBSD: mbuf.c,v 1.33 2014/11/06 12:50:55 dlg Exp $ */
+/* $OpenBSD: mbuf.c,v 1.34 2015/01/16 06:40:10 deraadt Exp $ */
/* $NetBSD: mbuf.c,v 1.9 1996/05/07 02:55:03 thorpej Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MSIZE */
#include <sys/protosw.h>
#include <sys/socket.h>
#include <sys/mbuf.h>
-/* $OpenBSD: mroute.c,v 1.22 2014/08/14 12:34:04 mpi Exp $ */
+/* $OpenBSD: mroute.c,v 1.23 2015/01/16 06:40:10 deraadt Exp $ */
/* $NetBSD: mroute.c,v 1.10 1996/05/11 13:51:27 mycroft Exp $ */
/*
* MROUTING 1.0
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/protosw.h>
-/* $OpenBSD: mroute6.c,v 1.14 2014/11/21 17:49:00 mikeb Exp $ */
+/* $OpenBSD: mroute6.c,v 1.15 2015/01/16 06:40:10 deraadt Exp $ */
/*
* Copyright (C) 1998 WIDE Project.
* @(#)mroute.c 8.2 (Berkeley) 4/28/95
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/protosw.h>
-/* $OpenBSD: net80211.c,v 1.12 2014/11/21 17:49:00 mikeb Exp $ */
+/* $OpenBSD: net80211.c,v 1.13 2015/01/16 06:40:10 deraadt Exp $ */
/*
* Copyright (c) 2005 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/file.h>
-/* $OpenBSD: route.c,v 1.94 2014/12/26 05:47:23 tedu Exp $ */
+/* $OpenBSD: route.c,v 1.95 2015/01/16 06:40:10 deraadt Exp $ */
/* $NetBSD: route.c,v 1.15 1996/05/07 02:55:06 thorpej Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/protosw.h>
#include <sys/socket.h>
-/* $OpenBSD: show.c,v 1.43 2014/10/23 16:45:57 schwarze Exp $ */
+/* $OpenBSD: show.c,v 1.44 2015/01/16 06:40:10 deraadt Exp $ */
/* $NetBSD: show.c,v 1.1 1996/11/15 18:01:41 gwr Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "netstat.h"
}
}
-static char line[MAXHOSTNAMELEN];
-static char domain[MAXHOSTNAMELEN];
+static char line[HOST_NAME_MAX+1];
+static char domain[HOST_NAME_MAX+1];
void
p_sockaddr_mpls(struct sockaddr *in, struct sockaddr *out, int flags, int width)
-/* $OpenBSD: unix.c,v 1.23 2014/07/10 14:08:13 deraadt Exp $ */
+/* $OpenBSD: unix.c,v 1.24 2015/01/16 06:40:10 deraadt Exp $ */
/* $NetBSD: unix.c,v 1.13 1995/10/03 21:42:48 thorpej Exp $ */
/*-
/*
* Display protocol blocks in the unix domain.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MSIZE */
#include <sys/protosw.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
-/* $OpenBSD: newsyslog.c,v 1.92 2013/11/26 13:19:07 deraadt Exp $ */
+/* $OpenBSD: newsyslog.c,v 1.93 2015/01/16 06:40:10 deraadt Exp $ */
/*
* Copyright (c) 1999, 2002, 2003 Todd C. Miller <Todd.Miller@courtesan.com>
#define SENDMAIL "/usr/lib/sendmail"
#endif
-#include <sys/param.h>
+#include <sys/param.h> /* DEV_BSIZE */
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/wait.h>
int force = 0; /* Force the logs to be rotated */
char *conf = CONF; /* Configuration file to use */
time_t timenow;
-char hostname[MAXHOSTNAMELEN]; /* Hostname */
+char hostname[HOST_NAME_MAX+1]; /* Hostname */
char *daytime; /* timenow in human readable form */
char *arcdir; /* Dir to put archives in (if it exists) */
break;
if (*q == '/') {
*(parse = son(parse)) = '\0';
- if (strlen(q) >= MAXPATHLEN)
+ if (strlen(q) >= PATH_MAX)
errx(1, "%s:%d: pathname too long: %s",
conf, lineno, q);
working->pidfile = strdup(q);
} else
working->backdir = NULL;
- /* Make sure we can't oflow MAXPATHLEN */
+ /* Make sure we can't oflow PATH_MAX */
if (working->backdir != NULL) {
if (snprintf(line, sizeof(line), "%s/%s.%d%s",
working->backdir, working->logbase,
- working->numlogs, COMPRESS_POSTFIX) >= MAXPATHLEN)
+ working->numlogs, COMPRESS_POSTFIX) >= PATH_MAX)
errx(1, "%s:%d: pathname too long: %s",
conf, lineno, q);
} else {
if (snprintf(line, sizeof(line), "%s.%d%s",
working->log, working->numlogs, COMPRESS_POSTFIX)
- >= MAXPATHLEN)
+ >= PATH_MAX)
errx(1, "%s:%d: pathname too long: %s",
conf, lineno, working->log);
}
void
rotate(struct conf_entry *ent, const char *oldlog)
{
- char file1[MAXPATHLEN], file2[MAXPATHLEN], *suffix;
+ char file1[PATH_MAX], file2[PATH_MAX], *suffix;
int numdays = ent->numlogs - 1;
int done = 0;
void
dotrim(struct conf_entry *ent)
{
- char file1[MAXPATHLEN], file2[MAXPATHLEN], oldlog[MAXPATHLEN];
+ char file1[PATH_MAX], file2[PATH_MAX], oldlog[PATH_MAX];
int fd;
/* Is there a separate backup dir? */
void
compress_log(struct conf_entry *ent)
{
- char *base, tmp[MAXPATHLEN];
+ char *base, tmp[PATH_MAX];
pid_t pid;
if (ent->backdir != NULL)
int
age_old_log(struct conf_entry *ent)
{
- char file[MAXPATHLEN];
+ char file[PATH_MAX];
struct stat sb;
if (ent->backdir != NULL)
int
domonitor(struct conf_entry *ent)
{
- char fname[MAXPATHLEN], *flog, *p, *rb = NULL;
+ char fname[PATH_MAX], *flog, *p, *rb = NULL;
struct stat sb, tsb;
off_t osize;
FILE *fp;
-/* $OpenBSD: nfsstat.c,v 1.33 2009/10/27 23:59:40 deraadt Exp $ */
+/* $OpenBSD: nfsstat.c,v 1.34 2015/01/16 06:40:10 deraadt Exp $ */
/* $NetBSD: nfsstat.c,v 1.7 1996/03/03 17:21:30 thorpej Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/mount.h>
#include <sys/sysctl.h>
#include <nfs/rpcv2.h>
-/* $OpenBSD: elf.c,v 1.23 2013/11/26 13:19:07 deraadt Exp $ */
+/* $OpenBSD: elf.c,v 1.24 2015/01/16 06:40:10 deraadt Exp $ */
/*
* Copyright (c) 2003 Michael Shalayeff
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/mman.h>
#include <unistd.h>
#include <a.out.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include <ctype.h>
#include "elfuncs.h"
#include "util.h"
-/* $OpenBSD: nm.c,v 1.41 2014/04/28 18:49:28 miod Exp $ */
+/* $OpenBSD: nm.c,v 1.42 2015/01/16 06:40:10 deraadt Exp $ */
/* $NetBSD: nm.c,v 1.7 1996/01/14 23:04:03 pk Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/mman.h>
#include <a.out.h>
#include <elf_abi.h>
-/* $OpenBSD: nohup.c,v 1.14 2009/10/27 23:59:41 deraadt Exp $ */
+/* $OpenBSD: nohup.c,v 1.15 2015/01/16 06:40:10 deraadt Exp $ */
/* $NetBSD: nohup.c,v 1.6 1995/08/31 23:35:25 jtc Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
+#include <limits.h>
#include <err.h>
static void dofile(void);
{
int fd;
const char *p;
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
p = FILENAME;
if ((fd = open(p, O_RDWR|O_CREAT|O_APPEND, S_IRUSR|S_IWUSR)) >= 0)
-/* $OpenBSD: yp_passwd.c,v 1.34 2014/11/21 05:13:44 tedu Exp $ */
+/* $OpenBSD: yp_passwd.c,v 1.35 2015/01/16 06:40:10 deraadt Exp $ */
/*
* Copyright (c) 1988 The Regents of the University of California.
#include <time.h>
#include <pwd.h>
#include <err.h>
+#include <signal.h>
#include <errno.h>
#include <ctype.h>
#include <login_cap.h>
-/* $OpenBSD: util.c,v 1.38 2014/12/13 10:31:07 tobias Exp $ */
+/* $OpenBSD: util.c,v 1.39 2015/01/16 06:40:10 deraadt Exp $ */
/*
* patch - a program to apply diffs to original files
* behaviour
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <ctype.h>
backup_file(const char *orig)
{
struct stat filestat;
- char bakname[MAXPATHLEN], *s, *simplename;
+ char bakname[PATH_MAX], *s, *simplename;
dev_t orig_device;
ino_t orig_inode;
char *
checked_in(char *file)
{
- char *filebase, *filedir, tmpbuf[MAXPATHLEN];
+ char *filebase, *filedir, tmpbuf[PATH_MAX];
struct stat filestat;
filebase = basename(file);
-/* $OpenBSD: pctr.c,v 1.20 2008/07/08 21:39:52 sobrado Exp $ */
+/* $OpenBSD: pctr.c,v 1.21 2015/01/16 06:40:10 deraadt Exp $ */
/*
* Copyright (c) 2007 Mike Belopuhov, Aleksey Lomovtsev
* OpenBSD project by leaving this copyright notice intact.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/sysctl.h>
-/* $OpenBSD: pkill.c,v 1.35 2014/05/07 01:27:42 tedu Exp $ */
+/* $OpenBSD: pkill.c,v 1.36 2015/01/16 06:40:10 deraadt Exp $ */
/* $NetBSD: pkill.c,v 1.5 2002/10/27 11:49:34 kleink Exp $ */
/*-
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/param.h> /* MAXCOMLEN */
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/proc.h>
#include <sys/queue.h>
struct passwd *pw;
struct group *gr;
struct stat st;
- char *sp, *p, buf[MAXPATHLEN];
+ char *sp, *p, buf[PATH_MAX];
int empty;
empty = 1;
-/* $OpenBSD: quota.c,v 1.32 2013/11/26 13:19:07 deraadt Exp $ */
+/* $OpenBSD: quota.c,v 1.33 2015/01/16 06:40:10 deraadt Exp $ */
/*
* Copyright (c) 1980, 1990, 1993
/*
* Disk quota reporting program.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* DEV_BSIZE */
#include <sys/types.h>
#include <sys/file.h>
#include <sys/stat.h>
struct quotause *next;
long flags;
struct dqblk dqblk;
- char fsname[MAXPATHLEN + 1];
+ char fsname[PATH_MAX + 1];
};
#define FOUND 0x01
-/* $OpenBSD: ci.c,v 1.218 2014/10/02 06:23:15 otto Exp $ */
+/* $OpenBSD: ci.c,v 1.219 2015/01/16 06:40:11 deraadt Exp $ */
/*
* Copyright (c) 2005, 2006 Niall O'Higgins <niallo@openbsd.org>
* All rights reserved.
RCSFILE *file;
RCSNUM *frev, *newrev;
const char *description, *symbol;
- char fpath[MAXPATHLEN], *rcs_msg, *username, *filename;
+ char fpath[PATH_MAX], *rcs_msg, *username, *filename;
char *author, *state;
BUF *deltatext;
};
-/* $OpenBSD: co.c,v 1.119 2014/10/10 08:15:25 otto Exp $ */
+/* $OpenBSD: co.c,v 1.120 2015/01/16 06:40:11 deraadt Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
RCSNUM *rev;
RCSFILE *file;
const char *author, *date, *state;
- char fpath[MAXPATHLEN];
+ char fpath[PATH_MAX];
char *rev_str, *username;
time_t rcs_mtime = -1;
-/* $OpenBSD: diff.c,v 1.36 2014/12/01 21:58:46 deraadt Exp $ */
+/* $OpenBSD: diff.c,v 1.37 2015/01/16 06:40:11 deraadt Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
* All rights reserved.
* @(#)diffreg.c 8.1 (Berkeley) 6/6/93
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <ctype.h>
#include <err.h>
#include <stdarg.h>
+#include <stdint.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "buf.h"
#include "diff.h"
#include "xmalloc.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
/*
* diff - compare two files.
*/
bound = UINT_MAX;
else {
sq = isqrt(n);
- bound = MAX(256, sq);
+ bound = MAXIMUM(256, sq);
}
k = 0;
return;
b = d = 0; /* gcc */
- lowa = MAX(1, cvp->a - diff_context);
- upb = MIN(len[0], context_vec_ptr->b + diff_context);
- lowc = MAX(1, cvp->c - diff_context);
- upd = MIN(len[1], context_vec_ptr->d + diff_context);
+ lowa = MAXIMUM(1, cvp->a - diff_context);
+ upb = MINIMUM(len[0], context_vec_ptr->b + diff_context);
+ lowc = MAXIMUM(1, cvp->c - diff_context);
+ upd = MINIMUM(len[1], context_vec_ptr->d + diff_context);
diff_output("***************");
if ((flags & D_PROTOTYPE)) {
return;
d = 0; /* gcc */
- lowa = MAX(1, cvp->a - diff_context);
- upb = MIN(len[0], context_vec_ptr->b + diff_context);
- lowc = MAX(1, cvp->c - diff_context);
- upd = MIN(len[1], context_vec_ptr->d + diff_context);
+ lowa = MAXIMUM(1, cvp->a - diff_context);
+ upb = MINIMUM(len[0], context_vec_ptr->b + diff_context);
+ lowc = MAXIMUM(1, cvp->c - diff_context);
+ upd = MINIMUM(len[1], context_vec_ptr->d + diff_context);
diff_output("@@ -");
uni_range(lowa, upb);
-/* $OpenBSD: diff3.c,v 1.34 2014/12/01 21:58:46 deraadt Exp $ */
+/* $OpenBSD: diff3.c,v 1.35 2015/01/16 06:40:11 deraadt Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
static int eflag = 3; /* default -E for compatibility with former RCS */
static int oflag = 1; /* default -E for compatibility with former RCS */
static int debug = 0;
-static char f1mark[MAXPATHLEN], f3mark[MAXPATHLEN]; /* markers for -E and -X */
+static char f1mark[PATH_MAX], f3mark[PATH_MAX]; /* markers for -E and -X */
static int duplicate(struct range *, struct range *);
static int edit(struct diff *, int, int);
-/* $OpenBSD: rcs.c,v 1.81 2014/10/10 08:15:25 otto Exp $ */
+/* $OpenBSD: rcs.c,v 1.82 2015/01/16 06:40:11 deraadt Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/param.h> /* MAXBSIZE */
#include <sys/stat.h>
#include <ctype.h>
#include "rcsutil.h"
#include "xmalloc.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
/* invalid characters in RCS states */
static const char rcs_state_invch[] = RCS_STATE_INVALCHAR;
/* XXX rcsnum_cmp() is totally broken for
* this purpose.
*/
- numlen = MIN(brev->rn_len,
+ numlen = MINIMUM(brev->rn_len,
rb->rb_num->rn_len - 1);
for (i = 0; i < numlen; i++) {
if (rb->rb_num->rn_id[i] !=
{
BUF *newbuf;
u_char *c, *kw, *fin;
- char buf[256], *tmpf, resolved[MAXPATHLEN], *rcsfile;
+ char buf[256], *tmpf, resolved[PATH_MAX], *rcsfile;
u_char *line, *line2;
u_int i, j;
int kwtype;
-/* $OpenBSD: rcsclean.c,v 1.53 2014/10/02 06:23:15 otto Exp $ */
+/* $OpenBSD: rcsclean.c,v 1.54 2015/01/16 06:40:11 deraadt Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
{
int fd, match;
RCSFILE *file;
- char fpath[MAXPATHLEN], numb[RCS_REV_BUFSZ];
+ char fpath[PATH_MAX], numb[RCS_REV_BUFSZ];
RCSNUM *rev;
BUF *b1, *b2;
time_t rcs_mtime = -1;
-/* $OpenBSD: rcsdiff.c,v 1.81 2014/12/01 21:58:46 deraadt Exp $ */
+/* $OpenBSD: rcsdiff.c,v 1.82 2015/01/16 06:40:11 deraadt Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
int fd, i, ch, dflags, status;
RCSNUM *rev1, *rev2;
RCSFILE *file;
- char fpath[MAXPATHLEN], *rev_str1, *rev_str2;
+ char fpath[PATH_MAX], *rev_str1, *rev_str2;
const char *errstr;
rev1 = rev2 = NULL;
-/* $OpenBSD: rcsmerge.c,v 1.54 2014/10/10 08:15:25 otto Exp $ */
+/* $OpenBSD: rcsmerge.c,v 1.55 2015/01/16 06:40:11 deraadt Exp $ */
/*
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
* All rights reserved.
rcsmerge_main(int argc, char **argv)
{
int fd, ch, flags, kflag, status;
- char fpath[MAXPATHLEN], r1[RCS_REV_BUFSZ], r2[RCS_REV_BUFSZ];
+ char fpath[PATH_MAX], r1[RCS_REV_BUFSZ], r2[RCS_REV_BUFSZ];
char *rev_str1, *rev_str2;
RCSFILE *file;
RCSNUM *rev1, *rev2;
-/* $OpenBSD: rcsnum.c,v 1.15 2014/12/01 21:58:46 deraadt Exp $ */
+/* $OpenBSD: rcsnum.c,v 1.16 2015/01/16 06:40:11 deraadt Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
-
#include <ctype.h>
#include <err.h>
#include <string.h>
+#include <limits.h>
#include "rcs.h"
#include "xmalloc.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
static void rcsnum_setsize(RCSNUM *, u_int);
static char *rcsnum_itoa(u_int16_t, char *, size_t);
u_int i;
size_t slen;
- slen = MIN(n1->rn_len, n2->rn_len);
+ slen = MINIMUM(n1->rn_len, n2->rn_len);
if (depth != 0 && slen > depth)
slen = depth;
-/* $OpenBSD: rcsprog.c,v 1.154 2014/12/01 21:58:46 deraadt Exp $ */
+/* $OpenBSD: rcsprog.c,v 1.155 2015/01/16 06:40:11 deraadt Exp $ */
/*
* Copyright (c) 2005 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
int fd;
int i, j, ch, flags, kflag, lkmode;
const char *nflag, *oldfilename, *orange;
- char fpath[MAXPATHLEN];
+ char fpath[PATH_MAX];
char *logstr, *logmsg, *descfile;
char *alist, *comment, *elist, *lrev, *urev;
mode_t fmode;
if (rcsflags & CO_ACLAPPEND) {
RCSFILE *oldfile;
int ofd;
- char ofpath[MAXPATHLEN];
+ char ofpath[PATH_MAX];
ofd = rcs_choosefile(oldfilename, ofpath, sizeof(ofpath));
if (ofd < 0) {
-/* $OpenBSD: rcsutil.c,v 1.42 2014/12/01 21:58:46 deraadt Exp $ */
+/* $OpenBSD: rcsutil.c,v 1.43 2015/01/16 06:40:11 deraadt Exp $ */
/*
* Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
{
int fd;
struct stat sb;
- char *p, *ext, name[MAXPATHLEN], *next, *ptr, rcsdir[MAXPATHLEN],
- *suffixes, rcspath[MAXPATHLEN];
+ char *p, *ext, name[PATH_MAX], *next, *ptr, rcsdir[PATH_MAX],
+ *suffixes, rcspath[PATH_MAX];
/*
* If `filename' contains a directory, `rcspath' contains that
*/
suffixes = xstrdup(rcs_suffixes);
for (next = suffixes; (ext = strsep(&next, "/")) != NULL;) {
- char fpath[MAXPATHLEN];
+ char fpath[PATH_MAX];
if ((p = strrchr(rcspath, ',')) != NULL) {
if (!strcmp(p, ext)) {
-/* $OpenBSD: rlog.c,v 1.70 2014/11/28 15:09:50 otto Exp $ */
+/* $OpenBSD: rlog.c,v 1.71 2015/01/16 06:40:11 deraadt Exp $ */
/*
* Copyright (c) 2005, 2009 Joris Vink <joris@openbsd.org>
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
RCSFILE *file;
int Rflag;
int i, ch, fd, status;
- char fpath[MAXPATHLEN];
+ char fpath[PATH_MAX];
rcsnum_flags |= RCSNUM_NO_MAGIC;
hflag = Rflag = rflag = status = 0;
-/* $OpenBSD: worklist.h,v 1.3 2010/07/23 08:31:19 ray Exp $ */
+/* $OpenBSD: worklist.h,v 1.4 2015/01/16 06:40:11 deraadt Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* All rights reserved.
#ifndef WORKLIST_H
#define WORKLIST_H
-#include <sys/param.h>
+#include <sys/types.h>
+#include <limits.h>
struct worklist {
- char wkl_path[MAXPATHLEN];
+ char wkl_path[PATH_MAX];
volatile SLIST_ENTRY(worklist) wkl_list;
};
-/* $OpenBSD: client.c,v 1.31 2014/07/12 03:48:04 guenther Exp $ */
+/* $OpenBSD: client.c,v 1.32 2015/01/16 06:40:11 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
static int
sendhardlink(opt_t opts, struct linkbuf *lp, char *rname, int destdir)
{
- static char buff[MAXPATHLEN];
+ static char buff[PATH_MAX];
char *lname; /* name of file to link to */
- char ername[MAXPATHLEN*4], elname[MAXPATHLEN*4];
+ char ername[PATH_MAX*4], elname[PATH_MAX*4];
debugmsg(DM_MISC,
"sendhardlink: rname='%s' pathname='%s' src='%s' target='%s'\n",
{
int goterr, f;
off_t i;
- char ername[MAXPATHLEN*4];
+ char ername[PATH_MAX*4];
if (stb->st_nlink > 1) {
struct linkbuf *lp;
struct stat stb;
int didupdate = 0;
int n;
- char targ[MAXPATHLEN*4];
+ char targ[PATH_MAX*4];
debugmsg(DM_CALL, "rmchk()\n");
char *optarget, *cp;
int len;
int didupdate = 0;
- char ername[MAXPATHLEN*4];
+ char ername[PATH_MAX*4];
/*
* Send recvdir command in recvit() format.
if (!strcmp(dp->d_name, ".") ||
!strcmp(dp->d_name, ".."))
continue;
- if (len + 1 + (int) strlen(dp->d_name) >= MAXPATHLEN - 1) {
+ if (len + 1 + (int) strlen(dp->d_name) >= PATH_MAX - 1) {
error("%s/%s: Name too long", target,
dp->d_name);
continue;
{
int f, n;
static char tbuf[BUFSIZ];
- char lbuf[MAXPATHLEN];
+ char lbuf[PATH_MAX];
u_char *s;
- char ername[MAXPATHLEN*4];
+ char ername[PATH_MAX*4];
debugmsg(DM_CALL, "sendlink(%s, %lx, stb, %d)\n", rname, opts, destdir);
char *owner = NULL, *group = NULL;
int done, n;
u_char *cp;
- char ername[MAXPATHLEN*4];
+ char ername[PATH_MAX*4];
debugmsg(DM_CALL, "update(%s, 0x%lx, %p)\n", rname, opts, statp);
struct stat *st, char *user, char *group)
{
int rv = 0;
- char ername[MAXPATHLEN*4];
+ char ername[PATH_MAX*4];
int lmode = st->st_mode & 07777;
if (u == US_CHMOG) {
int
install(char *src, char *dest, int ddir, int destdir, opt_t opts)
{
- static char destcopy[MAXPATHLEN];
+ static char destcopy[PATH_MAX];
char *rname;
int didupdate = 0;
- char ername[MAXPATHLEN*4];
+ char ername[PATH_MAX*4];
debugmsg(DM_CALL,
"install(src=%s,dest=%s,ddir=%d,destdir=%d,opts=%ld) start\n",
-/* $OpenBSD: common.c,v 1.33 2014/07/12 03:32:00 guenther Exp $ */
+/* $OpenBSD: common.c,v 1.34 2015/01/16 06:40:11 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
/*
* Variables common to both client and server
*/
-char host[MAXHOSTNAMELEN]; /* Name of this host */
+char host[HOST_NAME_MAX+1]; /* Name of this host */
uid_t userid = (uid_t)-1; /* User's UID */
gid_t groupid = (gid_t)-1; /* User's GID */
char *homedir = NULL; /* User's $HOME */
-/* $OpenBSD: defs.h,v 1.31 2014/07/12 03:48:04 guenther Exp $ */
+/* $OpenBSD: defs.h,v 1.32 2015/01/16 06:40:11 deraadt Exp $ */
#ifndef __DEFS_H__
#define __DEFS_H__
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/file.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
+#include <limits.h>
#ifndef __GNUC__
# ifndef __attribute__
-/* $OpenBSD: message.c,v 1.21 2014/07/05 06:18:58 guenther Exp $ */
+/* $OpenBSD: message.c,v 1.22 2015/01/16 06:40:11 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
void
checkhostname(void)
{
- static char mbuf[MAXHOSTNAMELEN];
+ static char mbuf[HOST_NAME_MAX+1];
char *cp;
if (!currenthost) {
-/* $OpenBSD: filesys-os.c,v 1.11 2014/07/05 10:21:24 guenther Exp $ */
+/* $OpenBSD: filesys-os.c,v 1.12 2015/01/16 06:40:11 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/mount.h>
#include "defs.h"
getmountent(void)
{
static mntent_t mntstruct;
- static char remote_dev[MAXHOSTNAMELEN+MAXPATHLEN+1];
+ static char remote_dev[HOST_NAME_MAX+1 + PATH_MAX + 1];
if (!entries_left)
return (NULL);
-/* $OpenBSD: filesys.c,v 1.16 2015/01/10 07:56:16 guenther Exp $ */
+/* $OpenBSD: filesys.c,v 1.17 2015/01/16 06:40:11 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/mount.h>
#include "defs.h"
char *
find_file(char *pathname, struct stat *statbuf, int *isvalid)
{
- static char last_pathname[MAXPATHLEN];
- static char file[MAXPATHLEN + 3];
+ static char last_pathname[PATH_MAX];
+ static char file[PATH_MAX + 3];
static struct stat filestat;
char *p;
-/* $OpenBSD: server.c,v 1.33 2014/07/12 03:10:03 guenther Exp $ */
+/* $OpenBSD: server.c,v 1.34 2015/01/16 06:40:11 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
char tempname[sizeof _RDIST_TMP + 1]; /* Tmp file name */
char buf[BUFSIZ]; /* general purpose buffer */
-char target[MAXPATHLEN]; /* target/source directory name */
+char target[PATH_MAX]; /* target/source directory name */
char *ptarget; /* pointer to end of target name */
int catname = 0; /* cat name to target name */
char *sptarget[32]; /* stack of saved ptarget's for directories */
(dp->d_name[1] == '.' && dp->d_name[2] == '\0')))
continue;
- if (len + 1 + (int)strlen(dp->d_name) >= MAXPATHLEN - 1) {
+ if (len + 1 + (int)strlen(dp->d_name) >= PATH_MAX - 1) {
if (!silent)
message(MT_REMOTE|MT_WARNING,
"%s/%s: Name too long",
char *optarget, *ep;
int len;
opt_t opts;
- char targ[MAXPATHLEN*4];
+ char targ[PATH_MAX*4];
opts = strtol(cp, &ep, 8);
if (*ep != CNULL) {
(dp->d_name[1] == '.' && dp->d_name[2] == '\0')))
continue;
- if (len + 1 + (int)strlen(dp->d_name) >= MAXPATHLEN - 1) {
+ if (len + 1 + (int)strlen(dp->d_name) >= PATH_MAX - 1) {
message(MT_REMOTE|MT_WARNING, "%s/%s: Name too long",
target, dp->d_name);
continue;
{
static struct stat stb;
int s = -1, stbvalid = 0;
- char name[MAXPATHLEN];
+ char name[PATH_MAX];
if (DECODE(name, xname) == -1) {
error("query: Cannot decode filename");
static char *
savetarget(char *file, opt_t opts)
{
- static char savefile[MAXPATHLEN];
+ static char savefile[PATH_MAX];
- if (strlen(file) + sizeof(SAVE_SUFFIX) + 1 > MAXPATHLEN) {
+ if (strlen(file) + sizeof(SAVE_SUFFIX) + 1 > PATH_MAX) {
error("%s: Cannot save: Save name too long", file);
return(NULL);
}
static void
recvlink(char *new, opt_t opts, int mode, off_t size)
{
- char tbuf[MAXPATHLEN], dbuf[BUFSIZ];
+ char tbuf[PATH_MAX], dbuf[BUFSIZ];
struct stat stb;
char *optarget;
int uptodate;
off_t size;
time_t mtime, atime;
char *owner, *group, *file;
- char new[MAXPATHLEN];
- char fileb[MAXPATHLEN];
+ char new[PATH_MAX];
+ char fileb[PATH_MAX];
int64_t freespace = -1, freefiles = -1;
char *cp = cmd;
opt_t opts;
char *owner, *group, *file;
char *cp = cmd;
- char fileb[MAXPATHLEN];
+ char fileb[PATH_MAX];
/*
* Get rdist option flags
-/* $OpenBSD: rpc_main.c,v 1.28 2014/11/18 20:54:28 krw Exp $ */
+/* $OpenBSD: rpc_main.c,v 1.29 2015/01/16 06:40:11 deraadt Exp $ */
/* $NetBSD: rpc_main.c,v 1.9 1996/02/19 11:12:43 pk Exp $ */
/*
#define RPCGEN_VERSION "199506"/* This program's version (year & month) */
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/file.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <ctype.h>
#include <sys/stat.h>
#include "rpc_parse.h"
static char *svcclosetime = "120";
static char *CPP = "/usr/bin/cpp";
static char CPPFLAGS[] = "-C";
-static char pathbuf[MAXPATHLEN];
+static char pathbuf[PATH_MAX];
static char *allv[] = {
"rpcgen", "-s", "udp", "-s", "tcp",
};
-/* $OpenBSD: rup.c,v 1.28 2014/11/26 18:34:51 millert Exp $ */
+/* $OpenBSD: rup.c,v 1.29 2015/01/16 06:40:11 deraadt Exp $ */
/*-
* Copyright (c) 1993, John Brezak
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include <sys/param.h>
#include <sys/socket.h>
#include <netdb.h>
#include <rpc/rpc.h>
-/* $OpenBSD: rusers.c,v 1.33 2014/11/26 18:34:51 millert Exp $ */
+/* $OpenBSD: rusers.c,v 1.34 2015/01/16 06:40:11 deraadt Exp $ */
/*
* Copyright (c) 2001, 2003 Todd C. Miller <Todd.Miller@courtesan.com>
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
+#include <sys/signal.h>
#include <rpc/rpc.h>
#include <rpc/pmap_prot.h>
#include <rpc/pmap_rmt.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
+#include <limits.h>
+
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
/* Preferred formatting */
#define HOST_WIDTH 17
outlen[1] = xdr_getpos(&xdr);
xdr_destroy(&xdr);
- maxfd = MAX(sock[0], sock[1]) + 1;
+ maxfd = MAXIMUM(sock[0], sock[1]) + 1;
fds = (fd_set *)calloc(howmany(maxfd, NFDBITS), sizeof(fd_mask));
if (fds == NULL)
err(1, NULL);
date[sizeof(date) - 1] = '\0';
fmt_idle(ut->ut_idle, idle_time, sizeof(idle_time));
len = termwidth -
- (MAX(strlen(ut->ut_user), NAME_WIDTH) + 1 +
+ (MAXIMUM(strlen(ut->ut_user), NAME_WIDTH) + 1 +
HOST_WIDTH + 1 + LINE_WIDTH + 1 + strlen(date) +
- 1 + MAX(8, strlen(idle_time)) + 1 + 2);
+ 1 + MAXIMUM(8, strlen(idle_time)) + 1 + 2);
if (len > 0 && ut->ut_host[0] != '\0')
snprintf(remote, sizeof(remote), "(%.*s)",
- MIN(len, RUSERS_MAXHOSTLEN), ut->ut_host);
+ MINIMUM(len, RUSERS_MAXHOSTLEN), ut->ut_host);
else
remote[0] = '\0';
- len = HOST_WIDTH - MIN(HOST_WIDTH, strlen(entry->host)) +
- LINE_WIDTH - MIN(LINE_WIDTH, strlen(ut->ut_line));
+ len = HOST_WIDTH - MINIMUM(HOST_WIDTH, strlen(entry->host)) +
+ LINE_WIDTH - MINIMUM(LINE_WIDTH, strlen(ut->ut_line));
printf("%-*s %.*s:%.*s%-*s %-12s %8s %s\n",
NAME_WIDTH, ut->ut_user, HOST_WIDTH, entry->host,
LINE_WIDTH, ut->ut_line, len, "", date,
-/* $OpenBSD: rwall.c,v 1.12 2009/10/27 23:59:43 deraadt Exp $ */
+/* $OpenBSD: rwall.c,v 1.13 2015/01/16 06:40:11 deraadt Exp $ */
/*
* Copyright (c) 1993 Christopher G. Demetriou
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <pwd.h>
#include <unistd.h>
+#include <limits.h>
#include <paths.h>
#include <err.h>
time_t now;
FILE *fp;
int fd;
- char *whom, hostname[MAXHOSTNAMELEN], lbuf[100], tmpname[MAXPATHLEN];
+ char *whom, hostname[HOST_NAME_MAX+1], lbuf[100], tmpname[PATH_MAX];
snprintf(tmpname, sizeof(tmpname), "%s/wall.XXXXXXXXXX", _PATH_TMP);
if ((fd = mkstemp(tmpname)) == -1 || !(fp = fdopen(fd, "r+")))
-/* $OpenBSD: sdiff.c,v 1.30 2013/11/26 21:08:12 deraadt Exp $ */
+/* $OpenBSD: sdiff.c,v 1.31 2015/01/16 06:40:11 deraadt Exp $ */
/*
* Written by Raymond Lai <ray@cyth.net>.
* Public domain.
*/
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/stat.h>
#include <sys/types.h>
-/* $OpenBSD: sendbug.c,v 1.68 2014/03/18 22:36:37 miod Exp $ */
+/* $OpenBSD: sendbug.c,v 1.69 2015/01/16 06:40:11 deraadt Exp $ */
/*
* Written by Ray Lai <ray@cyth.net>.
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/sysctl.h>
#include <sys/wait.h>
-/* $OpenBSD: skeyaudit.c,v 1.24 2008/11/12 16:13:46 sobrado Exp $ */
+/* $OpenBSD: skeyaudit.c,v 1.25 2015/01/16 06:40:11 deraadt Exp $ */
/*
* Copyright (c) 1997, 2000, 2003 Todd C. Miller <Todd.Miller@courtesan.com>
* Materiel Command, USAF, under agreement number F39502-99-1-0512.
*/
-#include <sys/param.h>
#include <sys/wait.h>
#include <err.h>
void
notify(struct passwd *pw, int seq, int interactive)
{
- static char hostname[MAXHOSTNAMELEN];
+ static char hostname[HOST_NAME_MAX+1];
pid_t pid;
FILE *out;
-/* $OpenBSD: skeyinit.c,v 1.55 2014/05/20 01:25:23 guenther Exp $ */
+/* $OpenBSD: skeyinit.c,v 1.56 2015/01/16 06:40:11 deraadt Exp $ */
/* OpenBSD S/Key (skeyinit.c)
*
* S/Key initialization and seed update
*/
-#include <sys/param.h>
#include <sys/file.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <syslog.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include <utmp.h>
#include <skey.h>
main(int argc, char **argv)
{
int rval, i, l, n, defaultsetup, rmkey, hexmode, enable, convert;
- char hostname[MAXHOSTNAMELEN];
+ char hostname[HOST_NAME_MAX+1];
char seed[SKEY_MAX_SEED_LEN + 1];
char buf[256], key[SKEY_BINKEY_SIZE], filename[PATH_MAX], *ht;
char lastc, me[UT_NAMESIZE + 1], *p, *auth_type;
-/* $OpenBSD: sndiod.c,v 1.6 2014/03/05 20:24:16 ratchov Exp $ */
+/* $OpenBSD: sndiod.c,v 1.7 2015/01/16 06:40:12 deraadt Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/stat.h>
#include <sys/types.h>
-/* $OpenBSD: msort.c,v 1.24 2013/11/13 15:07:27 deraadt Exp $ */
+/* $OpenBSD: msort.c,v 1.25 2015/01/16 06:40:12 deraadt Exp $ */
/*-
* Copyright (c) 1993
* SUCH DAMAGE.
*/
+#include <sys/param.h> /* ALIGN */
+
#include "sort.h"
#include "fsort.h"
-/* $OpenBSD: sort.h,v 1.7 2007/08/21 20:29:25 millert Exp $ */
+/* $OpenBSD: sort.h,v 1.8 2015/01/16 06:40:12 deraadt Exp $ */
/*-
* Copyright (c) 1993
* @(#)sort.h 8.1 (Berkeley) 6/6/93
*/
-#include <sys/param.h>
-
#include <db.h>
#include <err.h>
#include <errno.h>
-/* $OpenBSD: tmp.c,v 1.9 2009/10/27 23:59:43 deraadt Exp $ */
+/* $OpenBSD: tmp.c,v 1.10 2015/01/16 06:40:12 deraadt Exp $ */
/*-
* Copyright (c) 1993
* SUCH DAMAGE.
*/
-#include <sys/param.h>
-
#include <err.h>
#include <errno.h>
#include <limits.h>
-/* $OpenBSD: spellprog.c,v 1.8 2014/05/20 01:25:23 guenther Exp $ */
+/* $OpenBSD: spellprog.c,v 1.9 2015/01/16 06:40:12 deraadt Exp $ */
/*
* Copyright (c) 1991, 1993
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/mman.h>
#include <sys/stat.h>
-/* $OpenBSD: split.c,v 1.17 2009/10/27 23:59:43 deraadt Exp $ */
+/* $OpenBSD: split.c,v 1.18 2015/01/16 06:40:12 deraadt Exp $ */
/* $NetBSD: split.c,v 1.5 1995/08/31 22:22:05 jtc Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXBSIZE */
#include <sys/types.h>
#include <ctype.h>
int file_open; /* If a file open. */
int ifd = -1, ofd = -1; /* Input/output file descriptors. */
char bfr[MAXBSIZE]; /* I/O buffer. */
-char fname[MAXPATHLEN]; /* File name prefix. */
+char fname[PATH_MAX]; /* File name prefix. */
regex_t rgx;
int pflag;
int sufflen = 2; /* File name suffix length. */
-/* $OpenBSD: atomicio.c,v 1.26 2010/09/22 22:58:51 djm Exp $ */
+/* $OpenBSD: atomicio.c,v 1.27 2015/01/16 06:40:12 deraadt Exp $ */
/*
* Copyright (c) 2006 Damien Miller. All rights reserved.
* Copyright (c) 2005 Anil Madhavapeddy. All rights reserved.
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/uio.h>
#include <errno.h>
#include <poll.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "atomicio.h"
-/* $OpenBSD: misc.c,v 1.95 2014/10/24 02:01:20 lteo Exp $ */
+/* $OpenBSD: misc.c,v 1.96 2015/01/16 06:40:12 deraadt Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2005,2006 Damien Miller. All rights reserved.
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/un.h>
-#include <sys/param.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netdb.h>
#include <paths.h>
#include <pwd.h>
+#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
if (path != NULL)
filename = path + 1;
- if (xasprintf(&ret, "%s%s%s", pw->pw_dir, sep, filename) >= MAXPATHLEN)
+ if (xasprintf(&ret, "%s%s%s", pw->pw_dir, sep, filename) >= PATH_MAX)
fatal("tilde_expand_filename: Path too long");
return (ret);
-/* $OpenBSD: readconf.c,v 1.227 2015/01/15 09:40:00 djm Exp $ */
+/* $OpenBSD: readconf.c,v 1.228 2015/01/16 06:40:12 deraadt Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <util.h>
#include <vis.h>
-/* $OpenBSD: scp.c,v 1.180 2014/06/24 02:21:01 djm Exp $ */
+/* $OpenBSD: scp.c,v 1.181 2015/01/16 06:40:12 deraadt Exp $ */
/*
* scp - secure remote copy. This is basically patched BSD rcp which
* uses ssh to do the data transfer (instead of using rcmd).
*
*/
-#include <sys/param.h>
+#include <sys/param.h> /* roundup MAX */
#include <sys/types.h>
#include <sys/poll.h>
#include <sys/wait.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include <vis.h>
#include "xmalloc.h"
off_t i, statbytes;
size_t amt, nr;
int fd = -1, haderr, indx;
- char *last, *name, buf[2048], encname[MAXPATHLEN];
+ char *last, *name, buf[2048], encname[PATH_MAX];
int len;
for (indx = 0; indx < argc; ++indx) {
{
DIR *dirp;
struct dirent *dp;
- char *last, *vect[1], path[MAXPATHLEN];
+ char *last, *vect[1], path[PATH_MAX];
if (!(dirp = opendir(name))) {
run_err("%s: %s", name, strerror(errno));
-/* $OpenBSD: servconf.c,v 1.258 2015/01/13 07:39:19 djm Exp $ */
+/* $OpenBSD: servconf.c,v 1.259 2015/01/16 06:40:12 deraadt Exp $ */
/*
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
* All rights reserved
#include <string.h>
#include <signal.h>
#include <unistd.h>
+#include <limits.h>
#include <stdarg.h>
#include <errno.h>
#include <util.h>
char *
derelativise_path(const char *path)
{
- char *expanded, *ret, cwd[MAXPATHLEN];
+ char *expanded, *ret, cwd[PATH_MAX];
if (strcasecmp(path, "none") == 0)
return xstrdup("none");
-/* $OpenBSD: session.c,v 1.276 2015/01/14 20:05:27 djm Exp $ */
+/* $OpenBSD: session.c,v 1.277 2015/01/16 06:40:12 deraadt Exp $ */
/*
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
* All rights reserved
#include <sys/un.h>
#include <sys/stat.h>
#include <sys/socket.h>
-#include <sys/param.h>
#include <sys/queue.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "xmalloc.h"
#include "ssh.h"
safely_chroot(const char *path, uid_t uid)
{
const char *cp;
- char component[MAXPATHLEN];
+ char component[PATH_MAX];
struct stat st;
if (*path != '/')
-/* $OpenBSD: ssh-add.c,v 1.116 2015/01/14 20:05:27 djm Exp $ */
+/* $OpenBSD: ssh-add.c,v 1.117 2015/01/16 06:40:12 deraadt Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/param.h>
#include <openssl/evp.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "xmalloc.h"
#include "ssh.h"
goto done;
}
if (argc == 0) {
- char buf[MAXPATHLEN];
+ char buf[PATH_MAX];
struct passwd *pw;
struct stat st;
int count = 0;
-/* $OpenBSD: ssh-agent.c,v 1.195 2015/01/14 19:33:41 djm Exp $ */
+/* $OpenBSD: ssh-agent.c,v 1.196 2015/01/16 06:40:12 deraadt Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/param.h> /* MIN MAX */
#include <sys/types.h>
#include <sys/time.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/un.h>
-#include <sys/param.h>
#ifdef WITH_OPENSSL
#include <openssl/evp.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <limits.h>
#include <time.h>
#include <unistd.h>
pid_t cleanup_pid = 0;
/* pathname and directory for AUTH_SOCKET */
-char socket_name[MAXPATHLEN];
-char socket_dir[MAXPATHLEN];
+char socket_name[PATH_MAX];
+char socket_dir[PATH_MAX];
/* locking */
int locked = 0;
-/* $OpenBSD: ssh-keygen.c,v 1.252 2015/01/15 09:40:00 djm Exp $ */
+/* $OpenBSD: ssh-keygen.c,v 1.253 2015/01/16 06:40:12 deraadt Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
-#include <sys/param.h>
#include <openssl/evp.h>
#include <openssl/pem.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "xmalloc.h"
#include "sshkey.h"
FILE *in, *out = stdout;
struct sshkey *pub;
char *cp, *cp2, *kp, *kp2;
- char line[16*1024], tmp[MAXPATHLEN], old[MAXPATHLEN];
+ char line[16*1024], tmp[PATH_MAX], old[PATH_MAX];
int c, skip = 0, inplace = 0, num = 0, invalid = 0, has_unhashed = 0;
int r, ca, revoked;
int found_key = 0;
int
main(int argc, char **argv)
{
- char dotsshdir[MAXPATHLEN], comment[1024], *passphrase1, *passphrase2;
+ char dotsshdir[PATH_MAX], comment[1024], *passphrase1, *passphrase2;
char *checkpoint = NULL;
- char out_file[MAXPATHLEN], *rr_hostname = NULL, *ep;
+ char out_file[PATH_MAX], *rr_hostname = NULL, *ep;
struct sshkey *private, *public;
struct passwd *pw;
struct stat st;
fatal("Output filename too long");
break;
case 'K':
- if (strlen(optarg) >= MAXPATHLEN)
+ if (strlen(optarg) >= PATH_MAX)
fatal("Checkpoint filename too long");
checkpoint = xstrdup(optarg);
break;
-/* $OpenBSD: sshkey.c,v 1.12 2015/01/14 10:46:28 djm Exp $ */
+/* $OpenBSD: sshkey.c,v 1.13 2015/01/16 06:40:12 deraadt Exp $ */
/*
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
* Copyright (c) 2008 Alexander von Gernler. All rights reserved.
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MIN MAX */
#include <sys/types.h>
#include <netinet/in.h>
#include <stdio.h>
#include <string.h>
#include <util.h>
+#include <limits.h>
#include <resolv.h>
#include "ssh2.h"
-/* $OpenBSD: sshlogin.c,v 1.29 2014/07/15 15:54:14 millert Exp $ */
+/* $OpenBSD: sshlogin.c,v 1.30 2015/01/16 06:40:12 deraadt Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
*/
#include <sys/types.h>
-#include <sys/param.h>
+#include <sys/param.h> /* MAXHOSTNAMELEN */
#include <sys/socket.h>
#include <errno.h>
-/* $OpenBSD: uidswap.c,v 1.36 2013/11/08 11:15:19 dtucker Exp $ */
+/* $OpenBSD: uidswap.c,v 1.37 2015/01/16 06:40:12 deraadt Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
* called by a name other than "ssh" or "Secure Shell".
*/
-#include <sys/param.h>
#include <errno.h>
#include <pwd.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <stdarg.h>
#include <stdlib.h>
-/* $OpenBSD: xmalloc.c,v 1.29 2014/01/04 17:50:55 tedu Exp $ */
+/* $OpenBSD: xmalloc.c,v 1.30 2015/01/16 06:40:12 deraadt Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
* called by a name other than "ssh" or "Secure Shell".
*/
-#include <sys/param.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include "xmalloc.h"
#include "log.h"
-/* $OpenBSD: su.c,v 1.65 2011/01/11 10:07:56 robert Exp $ */
+/* $OpenBSD: su.c,v 1.66 2015/01/16 06:40:13 deraadt Exp $ */
/*
* Copyright (c) 1988 The Regents of the University of California.
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
+#include <limits.h>
#include <utmp.h>
#include <stdarg.h>
#include <bsd_auth.h>
char *user, *shell = NULL, *avshell, *username, **np;
char *class = NULL, *style = NULL, *p;
enum { UNSET, YES, NO } iscsh = UNSET;
- char avshellbuf[MAXPATHLEN];
+ char avshellbuf[PATH_MAX];
extern char **environ;
auth_session_t *as;
struct passwd *pwd;
char *
ontty(void)
{
- static char buf[MAXPATHLEN + 4];
+ static char buf[PATH_MAX + 4];
char *p;
buf[0] = 0;
-/* $OpenBSD: get_names.c,v 1.19 2010/08/12 23:31:29 tedu Exp $ */
+/* $OpenBSD: get_names.c,v 1.20 2015/01/16 06:40:13 deraadt Exp $ */
/* $NetBSD: get_names.c,v 1.4 1994/12/09 02:14:16 jtc Exp $ */
/*
*/
#include "talk.h"
-#include <sys/param.h>
#include <pwd.h>
#include <stdlib.h>
#include <unistd.h>
+#include <limits.h>
extern CTL_MSG msg;
void
get_names(int argc, char *argv[])
{
- char hostname[MAXHOSTNAMELEN];
+ char hostname[HOST_NAME_MAX+1];
char *his_name, *my_name;
char *my_machine_name, *his_machine_name;
char *his_tty;
-/* $OpenBSD: commands.c,v 1.70 2014/09/09 03:41:08 guenther Exp $ */
+/* $OpenBSD: commands.c,v 1.71 2015/01/16 06:40:13 deraadt Exp $ */
/* $NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $ */
/*
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#ifdef SKEY
#include <sys/wait.h>
if ((ep = env_find("DISPLAY"))
&& ((*ep->value == ':')
|| (strncmp(ep->value, "unix:", 5) == 0))) {
- char hbuf[MAXHOSTNAMELEN];
+ char hbuf[HOST_NAME_MAX+1];
char *cp2 = strchr(ep->value, ':');
gethostname(hbuf, sizeof hbuf);
int gotmachine = 0;
int l1 = strlen(m1);
int l2 = strlen(m2);
- char m1save[MAXHOSTNAMELEN];
+ char m1save[HOST_NAME_MAX+1];
if (skiprc)
return;
-/* $OpenBSD: main.c,v 1.34 2013/11/26 21:08:12 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.35 2015/01/16 06:40:13 deraadt Exp $ */
/* $NetBSD: main.c,v 1.6 1995/05/21 16:54:10 mycroft Exp $ */
/*
* This version includes many modifications by Jim Guyton <guyton@rand-unix>
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/file.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "extern.h"
void intr(int);
int rexmtval = TIMEOUT;
int maxtimeout = 5 * TIMEOUT;
-char hostname[MAXHOSTNAMELEN];
+char hostname[HOST_NAME_MAX+1];
FILE *file = NULL;
volatile sig_atomic_t intrflag = 0;
char *ackbuf;
-/* $OpenBSD: progs.priv.h,v 1.9 2010/01/12 23:22:14 nicm Exp $ */
+/* $OpenBSD: progs.priv.h,v 1.10 2015/01/16 06:40:13 deraadt Exp $ */
/****************************************************************************
* Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
* Author: Thomas E. Dickey 1997-on *
****************************************************************************/
/*
- * $Id: progs.priv.h,v 1.9 2010/01/12 23:22:14 nicm Exp $
+ * $Id: progs.priv.h,v 1.10 2015/01/16 06:40:13 deraadt Exp $
*
* progs.priv.h
*
#if HAVE_LIMITS_H
# include <limits.h>
#elif HAVE_SYS_PARAM_H
-# include <sys/param.h>
+# include <sys/param.h> /* only if no limits.h */
#endif
#if HAVE_DIRENT_H
-/* $OpenBSD: time.c,v 1.19 2013/04/16 23:43:00 deraadt Exp $ */
+/* $OpenBSD: time.c,v 1.20 2015/01/16 06:40:13 deraadt Exp $ */
/* $NetBSD: time.c,v 1.7 1995/06/27 00:34:00 jtc Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/wait.h>
-/* $OpenBSD: procname.c,v 1.13 2014/07/04 05:58:31 guenther Exp $ */
+/* $OpenBSD: procname.c,v 1.14 2015/01/16 06:40:13 deraadt Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXCOMLEN */
+#include <sys/types.h>
#include <sys/proc.h>
#include <sys/sysctl.h>
#include <sys/stat.h>
-/* $OpenBSD: machine.c,v 1.80 2014/09/17 01:56:54 dlg Exp $ */
+/* $OpenBSD: machine.c,v 1.81 2015/01/16 06:40:13 deraadt Exp $ */
/*-
* Copyright (c) 1994 Thorsten Lockert <tholo@sigmasoft.com>
* Patch for new swapctl(2) by Tobias Weingartner <weingart@openbsd.org>
*/
+#include <sys/param.h> /* DEV_BSIZE MAXCOMLEN PZERO */
#include <sys/types.h>
-#include <sys/param.h>
+#include <sys/signal.h>
#include <sys/mount.h>
#include <sys/proc.h>
#include <sys/sched.h>
-/* $OpenBSD: utils.c,v 1.24 2013/04/02 06:04:50 guenther Exp $ */
+/* $OpenBSD: utils.c,v 1.25 2015/01/16 06:40:13 deraadt Exp $ */
/*
* Top users/processes display for Unix
* This file contains various handy utilities used by top.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/sysctl.h>
#include <err.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
+#include <limits.h>
#include "top.h"
#include "machine.h"
-/* $OpenBSD: tput.c,v 1.20 2014/10/08 04:10:47 doug Exp $ */
+/* $OpenBSD: tput.c,v 1.21 2015/01/16 06:40:13 deraadt Exp $ */
/*
* Copyright (c) 1999 Todd C. Miller <Todd.Miller@courtesan.com>
* SUCH DAMAGE.
*/
-#include <sys/param.h>
-
#include <ctype.h>
#include <err.h>
#include <curses.h>
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>
+#include <limits.h>
#include <string.h>
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
#include <sys/wait.h>
static void init(void);
}
}
}
- arg_need = MAX(arg_need, popcount);
+ arg_need = MAXIMUM(arg_need, popcount);
if (arg_need > 9)
errx(2, "too many arguments (%d) for capability `%s'",
arg_need, cap);
-/* $OpenBSD: uname.c,v 1.12 2011/10/21 14:48:02 ajacoutot Exp $ */
+/* $OpenBSD: uname.c,v 1.13 2015/01/16 06:40:13 deraadt Exp $ */
/*
* Copyright (c) 1994 Winning Strategies, Inc.
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MACHINE_ARCH */
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
-/* $OpenBSD: uudecode.c,v 1.19 2014/05/20 01:25:23 guenther Exp $ */
+/* $OpenBSD: uudecode.c,v 1.20 2015/01/16 06:40:13 deraadt Exp $ */
/* $FreeBSD: uudecode.c,v 1.49 2003/05/03 19:44:46 obrien Exp $ */
/*-
* Used with uuencode.
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
static const char *infile, *outfile;
static FILE *infp, *outfp;
void *handle;
struct passwd *pw;
struct stat st;
- char buf[MAXPATHLEN];
+ char buf[PATH_MAX];
base64 = 0;
/* search for header line */
{
int i, ch;
char *p;
- char buf[MAXPATHLEN];
+ char buf[PATH_MAX];
/* for each input line */
for (;;) {
base64_decode(void)
{
int n;
- char inbuf[MAXPATHLEN];
- unsigned char outbuf[MAXPATHLEN * 4];
+ char inbuf[PATH_MAX];
+ unsigned char outbuf[PATH_MAX * 4];
for (;;) {
switch (get_line(inbuf, sizeof(inbuf))) {
-/* $OpenBSD: uuencode.c,v 1.10 2009/10/27 23:59:46 deraadt Exp $ */
+/* $OpenBSD: uuencode.c,v 1.11 2015/01/16 06:40:13 deraadt Exp $ */
/* $FreeBSD: uuencode.c,v 1.18 2004/01/22 07:23:35 grehan Exp $ */
/*-
* Encode a file so it can be mailed to a remote system.
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/stat.h>
-/* $OpenBSD: vacation.c,v 1.34 2013/11/26 19:25:39 deraadt Exp $ */
+/* $OpenBSD: vacation.c,v 1.35 2015/01/16 06:40:13 deraadt Exp $ */
/* $NetBSD: vacation.c,v 1.7 1995/04/29 05:58:27 cgd Exp $ */
/*
** Berkeley, California
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <pwd.h>
-/* $OpenBSD: exf.c,v 1.32 2014/11/14 20:23:56 tedu Exp $ */
+/* $OpenBSD: exf.c,v 1.33 2015/01/16 06:40:14 deraadt Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
#include "config.h"
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/stat.h>
struct stat sb;
size_t psize;
int fd, exists, open_err, readonly;
- char *oname, tname[MAXPATHLEN];
+ char *oname, tname[PATH_MAX];
open_err = readonly = 0;
CHAR_T savech;
size_t len;
int found;
- char *name, *p, *t, path[MAXPATHLEN];
+ char *name, *p, *t, path[PATH_MAX];
/*
* If the name is NULL or an explicit reference (i.e., the first
size_t len;
u_long nlno, nch;
int fd, nf, noname, oflags, rval;
- char *p, *s, *t, buf[MAXPATHLEN + 64];
+ char *p, *s, *t, buf[PATH_MAX + 64];
const char *msgstr;
ep = sp->ep;
-/* $OpenBSD: key.c,v 1.13 2014/11/12 04:28:41 bentley Exp $ */
+/* $OpenBSD: key.c,v 1.14 2015/01/16 06:40:14 deraadt Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
#include "config.h"
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/time.h>
#include "common.h"
#include "../vi/vi.h"
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
static int v_event_append(SCR *, EVENT *);
static int v_event_grow(SCR *, int);
static int v_key_cmp(const void *, const void *);
*/
#define TERM_PUSH_SHIFT 30
total = gp->i_cnt + gp->i_next + nitems + TERM_PUSH_SHIFT;
- if (total >= gp->i_nelem && v_event_grow(sp, MAX(total, 64)))
+ if (total >= gp->i_nelem && v_event_grow(sp, MAXIMUM(total, 64)))
return (1);
if (gp->i_cnt)
MEMMOVE(gp->i_event + TERM_PUSH_SHIFT + nitems,
gp = sp->gp;
if (gp->i_event == NULL ||
nevents > gp->i_nelem - (gp->i_next + gp->i_cnt))
- v_event_grow(sp, MAX(nevents, 64));
+ v_event_grow(sp, MAXIMUM(nevents, 64));
evp = gp->i_event + gp->i_next + gp->i_cnt;
gp->i_cnt += nevents;
-/* $OpenBSD: msg.c,v 1.21 2014/11/12 16:29:04 millert Exp $ */
+/* $OpenBSD: msg.c,v 1.22 2015/01/16 06:40:14 deraadt Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
#include "config.h"
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/stat.h>
#include <sys/time.h>
DB *db;
DBT data, key;
recno_t msgno;
- char *p, *t, buf[MAXPATHLEN];
+ char *p, *t, buf[PATH_MAX];
if ((p = strrchr(file, '/')) != NULL && p[1] == '\0' &&
(((t = getenv("LC_MESSAGES")) != NULL && t[0] != '\0') ||
-/* $OpenBSD: recover.c,v 1.19 2014/11/14 20:27:03 tedu Exp $ */
+/* $OpenBSD: recover.c,v 1.20 2015/01/16 06:40:14 deraadt Exp $ */
/*-
* Copyright (c) 1993, 1994
#include "config.h"
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/stat.h>
{
struct stat sb;
int fd;
- char *dp, *p, path[MAXPATHLEN];
+ char *dp, *p, path[PATH_MAX];
/*
* !!!
time_t now;
uid_t uid;
int fd;
- char *dp, *p, *t, buf[4096], mpath[MAXPATHLEN];
+ char *dp, *p, *t, buf[4096], mpath[PATH_MAX];
char *t1, *t2, *t3;
- char host[MAXHOSTNAMELEN];
+ char host[HOST_NAME_MAX+1];
gp = sp->gp;
if ((pw = getpwuid(uid = getuid())) == NULL) {
DIR *dirp;
FILE *fp;
int found;
- char *p, *t, file[MAXPATHLEN], path[MAXPATHLEN];
+ char *p, *t, file[PATH_MAX], path[PATH_MAX];
/* Open the recovery directory for reading. */
if (opts_empty(sp, O_RECDIR, 0))
time_t rec_mtime;
int fd, found, locked, requested, sv_fd;
char *name, *p, *t, *rp, *recp, *pathp;
- char file[MAXPATHLEN], path[MAXPATHLEN], recpath[MAXPATHLEN];
+ char file[PATH_MAX], path[PATH_MAX], recpath[PATH_MAX];
if (opts_empty(sp, O_RECDIR, 0))
return (1);
rcv_email(SCR *sp, char *fname)
{
struct stat sb;
- char buf[MAXPATHLEN * 2 + 20];
+ char buf[PATH_MAX * 2 + 20];
if (_PATH_SENDMAIL[0] != '/' || stat(_PATH_SENDMAIL, &sb))
msgq_str(sp, M_SYSERR,
-/* $OpenBSD: seq.c,v 1.9 2014/11/12 04:28:41 bentley Exp $ */
+/* $OpenBSD: seq.c,v 1.10 2015/01/16 06:40:14 deraadt Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
#include "config.h"
-#include <sys/param.h>
#include <sys/queue.h>
#include <bitstring.h>
#include "common.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
/*
* seq_set --
* Internal version to enter a sequence.
if (qp->input[0] < c_input[0] ||
qp->stype != stype || F_ISSET(qp, SEQ_FUNCMAP))
continue;
- diff = memcmp(qp->input, c_input, MIN(qp->ilen, ilen));
+ diff = memcmp(qp->input, c_input, MINIMUM(qp->ilen, ilen));
} else {
if (qp->input[0] > e_input->e_c)
break;
qp->stype != stype || F_ISSET(qp, SEQ_FUNCMAP))
continue;
diff =
- e_memcmp(qp->input, e_input, MIN(qp->ilen, ilen));
+ e_memcmp(qp->input, e_input, MINIMUM(qp->ilen, ilen));
}
if (diff > 0)
break;
-/* $OpenBSD: util.c,v 1.9 2014/11/12 04:28:41 bentley Exp $ */
+/* $OpenBSD: util.c,v 1.10 2015/01/16 06:40:14 deraadt Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
#include "config.h"
-#include <sys/param.h>
#include <sys/queue.h>
#include <bitstring.h>
#include "common.h"
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
/*
* binc --
* Increase the size of a buffer.
if (min && *bsizep >= min)
return (bp);
- csize = *bsizep + MAX(min, 256);
+ csize = *bsizep + MAXIMUM(min, 256);
REALLOC(sp, bp, void *, csize);
if (bp == NULL) {
-/* $OpenBSD: ex_cd.c,v 1.10 2014/11/12 04:28:41 bentley Exp $ */
+/* $OpenBSD: ex_cd.c,v 1.11 2015/01/16 06:40:14 deraadt Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
#include "config.h"
-#include <sys/param.h>
#include <sys/queue.h>
#include <bitstring.h>
ARGS *ap;
CHAR_T savech;
char *dir, *p, *t; /* XXX: END OF THE STACK, DON'T TRUST GETCWD. */
- char buf[MAXPATHLEN * 2];
+ char buf[PATH_MAX * 2];
/*
* !!!
-/* $OpenBSD: ex_cscope.c,v 1.23 2014/11/14 20:27:03 tedu Exp $ */
+/* $OpenBSD: ex_cscope.c,v 1.24 2015/01/16 06:40:14 deraadt Exp $ */
/*-
* Copyright (c) 1994, 1996
#include "config.h"
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/stat.h>
#include <sys/time.h>
CSC *csc;
size_t len;
int cur_argc;
- char *dbname, path[MAXPATHLEN];
+ char *dbname, path[PATH_MAX];
exp = EXP(sp);
struct stat sb;
int fd, nentries;
size_t len;
- char *p, **pathp, buf[MAXPATHLEN * 2];
+ char *p, **pathp, buf[PATH_MAX * 2];
/*
* EXTENSION #2:
run_cscope(SCR *sp, CSC *csc, char *dbname)
{
int to_cs[2], from_cs[2];
- char cmd[MAXPATHLEN * 2];
+ char cmd[PATH_MAX * 2];
/*
* Cscope reads from to_cs[0] and writes to from_cs[1]; vi reads from
int *isolderp)
{
struct stat sb;
- char **pp, buf[MAXPATHLEN];
+ char **pp, buf[PATH_MAX];
/*
* Check for the file in all of the listed paths. If we don't
-/* $OpenBSD: ex_filter.c,v 1.12 2014/11/12 04:28:41 bentley Exp $ */
+/* $OpenBSD: ex_filter.c,v 1.13 2015/01/16 06:40:14 deraadt Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
#include "config.h"
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/queue.h>
pid_t parent_writer_pid, utility_pid;
recno_t nread;
int input[2], output[2], fd, rval;
- char *name, tname[MAXPATHLEN];
+ char *name, tname[PATH_MAX];
rval = 0;
-/* $OpenBSD: ex_init.c,v 1.13 2014/11/12 16:29:04 millert Exp $ */
+/* $OpenBSD: ex_init.c,v 1.14 2015/01/16 06:40:14 deraadt Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
#include "config.h"
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/stat.h>
ex_exrc(SCR *sp)
{
struct stat hsb, lsb;
- char *p, path[MAXPATHLEN];
+ char *p, path[PATH_MAX];
int fd;
/*
enum { ROOTOWN, OWN, WRITER } etype;
uid_t euid;
int nf1, nf2;
- char *a, *b, buf[MAXPATHLEN];
+ char *a, *b, buf[PATH_MAX];
if ((*fdp = open(path, O_RDONLY, 0)) < 0) {
if (errno == ENOENT)
-/* $OpenBSD: ex_shell.c,v 1.13 2014/11/12 04:28:41 bentley Exp $ */
+/* $OpenBSD: ex_shell.c,v 1.14 2015/01/16 06:40:14 deraadt Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
#include "config.h"
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/wait.h>
#include "../common/common.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
/*
* ex_shell -- :sh[ell]
* Invoke the program named in the SHELL environment variable
ex_shell(SCR *sp, EXCMD *cmdp)
{
int rval;
- char buf[MAXPATHLEN];
+ char buf[PATH_MAX];
/* We'll need a shell. */
if (opts_empty(sp, O_SHELL, 0))
p = msg_print(sp, cmd, &nf);
len = strlen(p);
msgq(sp, M_ERR, "%.*s%s: received signal: %s%s",
- MIN(len, 20), p, len > 20 ? " ..." : "",
+ MINIMUM(len, 20), p, len > 20 ? " ..." : "",
strsignal(WTERMSIG(pstat)),
WCOREDUMP(pstat) ? "; core dumped" : "");
if (nf)
p = msg_print(sp, cmd, &nf);
len = strlen(p);
msgq(sp, M_ERR, "%.*s%s: exited with status %d",
- MIN(len, 20), p, len > 20 ? " ..." : "",
+ MINIMUM(len, 20), p, len > 20 ? " ..." : "",
WEXITSTATUS(pstat));
if (nf)
FREE_SPACE(sp, p, 0);
-/* $OpenBSD: ex_subst.c,v 1.21 2014/11/12 04:28:41 bentley Exp $ */
+/* $OpenBSD: ex_subst.c,v 1.22 2015/01/16 06:40:14 deraadt Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
#include "config.h"
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/time.h>
#include "../common/common.h"
#include "../vi/vi.h"
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
#define SUB_FIRST 0x01 /* The 'r' flag isn't reasonable. */
#define SUB_MUSTSETR 0x02 /* The 'r' flag is required. */
#define BUILD(sp, l, len) { \
if (lbclen + (len) > lblen) { \
- lblen += MAX(lbclen + (len), 256); \
+ lblen += MAXIMUM(lbclen + (len), 256); \
REALLOC((sp), lb, char *, lblen); \
if (lb == NULL) { \
lbclen = 0; \
#define NEEDSP(sp, len, pnt) { \
if (lbclen + (len) > lblen) { \
- lblen += MAX(lbclen + (len), 256); \
+ lblen += MAXIMUM(lbclen + (len), 256); \
REALLOC((sp), lb, char *, lblen); \
if (lb == NULL) { \
lbclen = 0; \
-/* $OpenBSD: ex_tag.c,v 1.20 2014/11/12 16:29:04 millert Exp $ */
+/* $OpenBSD: ex_tag.c,v 1.21 2015/01/16 06:40:14 deraadt Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
#include "config.h"
-#include <sys/param.h>
#include <sys/mman.h>
#include <sys/queue.h>
#include <sys/stat.h>
ctag_file(SCR *sp, TAGF *tfp, char *name, char **dirp, size_t *dlenp)
{
struct stat sb;
- char *p, buf[MAXPATHLEN];
+ char *p, buf[PATH_MAX];
/*
* !!!
-/* $OpenBSD: v_scroll.c,v 1.9 2014/11/12 04:28:41 bentley Exp $ */
+/* $OpenBSD: v_scroll.c,v 1.10 2015/01/16 06:40:14 deraadt Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
#include "config.h"
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/time.h>
#include "../common/common.h"
#include "vi.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
static void goto_adjust(VICMD *);
/*
* least one line.
*/
offset = (F_ISSET(vp, VC_C1SET) ? vp->count : 1) * (IS_SPLIT(sp) ?
- MIN(sp->t_maxrows, O_VAL(sp, O_WINDOW)) : O_VAL(sp, O_WINDOW));
+ MINIMUM(sp->t_maxrows, O_VAL(sp, O_WINDOW)) : O_VAL(sp, O_WINDOW));
offset = offset <= 2 ? 1 : offset - 2;
if (vs_sm_scroll(sp, &vp->m_stop, offset, CNTRL_F))
return (1);
* least one line.
*/
offset = (F_ISSET(vp, VC_C1SET) ? vp->count : 1) * (IS_SPLIT(sp) ?
- MIN(sp->t_maxrows, O_VAL(sp, O_WINDOW)) : O_VAL(sp, O_WINDOW));
+ MINIMUM(sp->t_maxrows, O_VAL(sp, O_WINDOW)) : O_VAL(sp, O_WINDOW));
offset = offset <= 2 ? 1 : offset - 2;
if (vs_sm_scroll(sp, &vp->m_stop, offset, CNTRL_B))
return (1);
-/* $OpenBSD: v_txt.c,v 1.27 2014/11/12 04:28:41 bentley Exp $ */
+/* $OpenBSD: v_txt.c,v 1.28 2015/01/16 06:40:14 deraadt Exp $ */
/*-
* Copyright (c) 1993, 1994
#include "config.h"
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/stat.h>
#include <sys/time.h>
#include "../common/common.h"
#include "vi.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
static int txt_abbrev(SCR *, TEXT *, CHAR_T *, int, int *, int *);
static void txt_ai_resolve(SCR *, TEXT *, int *);
static TEXT *txt_backup(SCR *, TEXTH *, TEXT *, u_int32_t *);
* okay, the user just extended the file.
*/
if (input_len < orig_len) {
- retain = MIN(tp->owrite, orig_len - input_len);
+ retain = MINIMUM(tp->owrite, orig_len - input_len);
if (db_get(sp,
TAILQ_FIRST(tiqh)->lno, DBG_FATAL | DBG_NOCACHE, &p, NULL))
return;
-/* $OpenBSD: dkstats.c,v 1.36 2014/09/15 19:08:22 miod Exp $ */
+/* $OpenBSD: dkstats.c,v 1.37 2015/01/16 06:40:14 deraadt Exp $ */
/* $NetBSD: dkstats.c,v 1.1 1996/05/10 23:19:27 thorpej Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/disk.h>
#include <sys/sched.h>
/* $NetBSD: vmstat.c,v 1.29.4.1 1996/06/05 00:21:05 cgd Exp $ */
-/* $OpenBSD: vmstat.c,v 1.135 2014/12/19 20:18:15 tedu Exp $ */
+/* $OpenBSD: vmstat.c,v 1.136 2015/01/16 06:40:14 deraadt Exp $ */
/*
* Copyright (c) 1980, 1986, 1991, 1993
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXCOMLEN */
#include <sys/time.h>
#include <sys/proc.h>
#include <sys/namei.h>
-/* $OpenBSD: proc_compare.c,v 1.14 2014/07/04 05:58:31 guenther Exp $ */
+/* $OpenBSD: proc_compare.c,v 1.15 2015/01/16 06:40:14 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXCOMLEN */
#include <sys/proc.h>
#include <sys/sysctl.h>
#include <sys/time.h>
-/* $OpenBSD: w.c,v 1.56 2014/07/08 23:24:28 deraadt Exp $ */
+/* $OpenBSD: w.c,v 1.57 2015/01/16 06:40:14 deraadt Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993, 1994
* This program is similar to the systat command on Tenex/Tops 10/20
*
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXCOMLEN */
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/sysctl.h>
+#include <sys/signal.h>
#include <sys/proc.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
int nflag = 1; /* true if -n flag: don't convert addrs */
int sortidle; /* sort by idle time */
char *sel_user; /* login of particular user selected */
-char domain[MAXHOSTNAMELEN];
+char domain[HOST_NAME_MAX+1];
#define NAME_WIDTH 8
#define HOST_WIDTH 16
struct in_addr addr;
int ch, i, nentries, nusers, wcmd;
char *memf, *nlistf, *p, *x;
- char buf[MAXHOSTNAMELEN], errbuf[_POSIX2_LINE_MAX];
+ char buf[HOST_NAME_MAX+1], errbuf[_POSIX2_LINE_MAX];
/* Are we w(1) or uptime(1)? */
p = __progname;
-/* $OpenBSD: wall.c,v 1.25 2009/10/27 23:59:49 deraadt Exp $ */
+/* $OpenBSD: wall.c,v 1.26 2015/01/16 06:40:14 deraadt Exp $ */
/* $NetBSD: wall.c,v 1.6 1994/11/17 07:17:58 jtc Exp $ */
/*
* is entitled "Mechanisms for Broadcast and Selective Broadcast".
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/uio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <utmp.h>
#include <vis.h>
#include <err.h>
time_t now;
FILE *fp;
int fd;
- char *p, *whom, hostname[MAXHOSTNAMELEN], lbuf[100], tmpname[MAXPATHLEN];
+ char *p, *whom, hostname[HOST_NAME_MAX+1], lbuf[100], tmpname[PATH_MAX];
char tmpbuf[5];
char *ttynam;
-/* $OpenBSD: wc.c,v 1.16 2013/11/27 13:32:02 okan Exp $ */
+/* $OpenBSD: wc.c,v 1.17 2015/01/16 06:40:14 deraadt Exp $ */
/*
* Copyright (c) 1980, 1987, 1991, 1993
* SUCH DAMAGE.
*/
+#include <sys/param.h> /* MAXBSIZE */
+#include <sys/stat.h>
+#include <sys/file.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#include <ctype.h>
#include <err.h>
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <sys/file.h>
#include <unistd.h>
#include <util.h>
-/* $OpenBSD: which.c,v 1.19 2014/05/20 01:25:23 guenther Exp $ */
+/* $OpenBSD: which.c,v 1.20 2015/01/16 06:40:14 deraadt Exp $ */
/*
* Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/sysctl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#define PROG_WHICH 1
#define PROG_WHEREIS 2
int
findprog(char *prog, char *path, int progmode, int allmatches)
{
- char *p, filename[MAXPATHLEN];
+ char *p, filename[PATH_MAX];
int proglen, plen, rval = 0;
struct stat sbuf;
char *pathcpy;
-/* $OpenBSD: write.c,v 1.27 2013/04/16 19:24:55 deraadt Exp $ */
+/* $OpenBSD: write.c,v 1.28 2015/01/16 06:40:14 deraadt Exp $ */
/* $NetBSD: write.c,v 1.5 1995/08/31 21:48:32 jtc Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <ctype.h>
#include <stdio.h>
#include <paths.h>
#include <pwd.h>
#include <unistd.h>
+#include <limits.h>
#include <utmp.h>
#include <err.h>
#include <vis.h>
int
main(int argc, char *argv[])
{
- char tty[MAXPATHLEN], *mytty, *cp;
+ char tty[PATH_MAX], *mytty, *cp;
int msgsok, myttyfd;
time_t atime;
uid_t myuid;
term_chk(char *tty, int *msgsokP, time_t *atimeP, int showerror)
{
struct stat s;
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
(void)snprintf(path, sizeof(path), "%s%s", _PATH_DEV, tty);
if (stat(path, &s) < 0) {
char *login, *nows;
struct passwd *pwd;
time_t now;
- char path[MAXPATHLEN], host[MAXHOSTNAMELEN], line[512];
+ char path[PATH_MAX], host[HOST_NAME_MAX+1], line[512];
gid_t gid;
/* Determine our login name before the we reopen() stdout */
-/* $OpenBSD: x99token.c,v 1.9 2013/11/27 00:13:22 deraadt Exp $ */
+/* $OpenBSD: x99token.c,v 1.10 2015/01/16 06:40:14 deraadt Exp $ */
/*
* X9.9 calculator
*
* Donated to the Public Domain by Paul Borman
*/
-#include <sys/param.h>
+
#include <sys/stat.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <openssl/des.h>
#define KEYFILE ".keyfile.des"
char buf[256];
DES_key_schedule ks;
DES_cblock key;
- char _keyfile[MAXPATHLEN];
+ char _keyfile[PATH_MAX];
char *keyfile = 0;
FILE *fp;
int init = 0;
-/* $OpenBSD: xargs.c,v 1.27 2010/03/25 01:03:57 schwarze Exp $ */
+/* $OpenBSD: xargs.c,v 1.28 2015/01/16 06:40:14 deraadt Exp $ */
/* $FreeBSD: xargs.c,v 1.51 2003/05/03 19:09:11 obrien Exp $ */
/*-
* $xMach: xargs.c,v 1.6 2002/02/23 05:27:47 tim Exp $
*/
-#include <sys/param.h>
#include <sys/wait.h>
#include <ctype.h>
-/* $OpenBSD: xinstall.c,v 1.57 2014/05/20 01:25:23 guenther Exp $ */
+/* $OpenBSD: xinstall.c,v 1.58 2015/01/16 06:40:15 deraadt Exp $ */
/* $NetBSD: xinstall.c,v 1.9 1995/12/20 10:25:17 jonathan Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXBSIZE */
#include <sys/wait.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <sysexits.h>
#include <utime.h>
#include "pathnames.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
#define DIRECTORY 0x01 /* Tell install it's a directory. */
#define SETFLAGS 0x02 /* Tell install to set flags. */
#define NOCHANGEBITS (UF_IMMUTABLE | UF_APPEND | SF_IMMUTABLE | SF_APPEND)
struct group *gp;
int dobackup, docompare, dodir, dopreserve, dostrip, safecopy;
int mode = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
-char pathbuf[MAXPATHLEN], tempfile[MAXPATHLEN];
+char pathbuf[PATH_MAX], tempfile[PATH_MAX];
char *suffix = BACKUP_SUFFIX;
uid_t uid;
gid_t gid;
if (to_sb.st_flags & (NOCHANGEBITS))
(void)chflags(to_name, to_sb.st_flags & ~(NOCHANGEBITS));
if (dobackup) {
- char backup[MAXPATHLEN];
- (void)snprintf(backup, MAXPATHLEN, "%s%s", to_name,
+ char backup[PATH_MAX];
+ (void)snprintf(backup, PATH_MAX, "%s%s", to_name,
suffix);
/* It is ok for the target file not to exist. */
if (rename(to_name, backup) < 0 && errno != ENOENT) {
from_off = to_off = (off_t)0;
remainder = from_len;
do {
- length = MIN(remainder, 8 * 1048576);
+ length = MINIMUM(remainder, 8 * 1048576);
remainder -= length;
if ((p1 = mmap(NULL, length, PROT_READ, MAP_PRIVATE,
int
create_newfile(char *path, struct stat *sbp)
{
- char backup[MAXPATHLEN];
+ char backup[PATH_MAX];
/*
* Unlink now... avoid ETXTBSY errors later. Try and turn
(void)chflags(path, sbp->st_flags & ~(NOCHANGEBITS));
if (dobackup) {
- (void)snprintf(backup, MAXPATHLEN, "%s%s", path, suffix);
+ (void)snprintf(backup, PATH_MAX, "%s%s", path, suffix);
/* It is ok for the target file not to exist. */
if (rename(path, backup) < 0 && errno != ENOENT)
err(EX_OSERR, "rename: %s to %s (errno %d)", path, backup, errno);
* only examine up to the end of the current file block or
* remaining characters to write, whatever is smaller
*/
- wcnt = MIN(cnt, *rem);
+ wcnt = MINIMUM(cnt, *rem);
cnt -= wcnt;
*rem -= wcnt;
if (*isempt) {
-/* $OpenBSD: ypcat.c,v 1.14 2009/10/27 23:59:50 deraadt Exp $ */
+/* $OpenBSD: ypcat.c,v 1.15 2015/01/16 06:40:15 deraadt Exp $ */
/*
* Copyright (c) 1992, 1993, 1996 Theo de Raadt <deraadt@theos.com>
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
-/* $OpenBSD: ypmatch.c,v 1.14 2009/10/27 23:59:50 deraadt Exp $ */
+/* $OpenBSD: ypmatch.c,v 1.15 2015/01/16 06:40:15 deraadt Exp $ */
/* $NetBSD: ypmatch.c,v 1.8 1996/05/07 01:24:52 jtc Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
-/* $OpenBSD: ypwhich.c,v 1.21 2013/11/15 22:20:04 millert Exp $ */
+/* $OpenBSD: ypwhich.c,v 1.22 2015/01/16 06:40:15 deraadt Exp $ */
/* $NetBSD: ypwhich.c,v 1.6 1996/05/13 02:43:48 thorpej Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
-/* $OpenBSD: apm.c,v 1.28 2014/10/17 07:43:33 jmc Exp $ */
+/* $OpenBSD: apm.c,v 1.29 2015/01/16 06:40:15 deraadt Exp $ */
/*
* Copyright (c) 1996 John T. Kohl
*
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/sysctl.h>
#include <sys/socket.h>
#include <sys/un.h>
-/* $OpenBSD: apmd.c,v 1.73 2014/10/28 06:04:19 dcoppa Exp $ */
+/* $OpenBSD: apmd.c,v 1.74 2015/01/16 06:40:15 deraadt Exp $ */
/*
* Copyright (c) 1995, 1996 John T. Kohl
*
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <signal.h>
#include <errno.h>
#include <err.h>
+#include <limits.h>
#include <machine/apmvar.h>
+
#include "pathnames.h"
#include "apm-proto.h"
return acon;
}
-char socketname[MAXPATHLEN];
+char socketname[PATH_MAX];
void
sockunlink(void)
-/* $OpenBSD: arp.c,v 1.62 2014/09/07 22:40:30 bluhm Exp $ */
+/* $OpenBSD: arp.c,v 1.63 2015/01/16 06:40:15 deraadt Exp $ */
/* $NetBSD: arp.c,v 1.12 1995/04/24 13:25:18 cgd Exp $ */
/*
* arp - display, set, delete arp table entries and wake up hosts.
*/
-#include <sys/param.h>
#include <sys/file.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <string.h>
#include <paths.h>
#include <unistd.h>
+#include <limits.h>
#include <ifaddrs.h>
void dump(void);
int
get_bpf(void)
{
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
int i, fd;
for (i = 0; ; i++) {
-/* $OpenBSD: irr_asset.c,v 1.10 2014/10/08 16:15:37 deraadt Exp $ */
+/* $OpenBSD: irr_asset.c,v 1.11 2015/01/16 06:40:15 deraadt Exp $ */
/*
* Copyright (c) 2007 Henning Brauer <henning@openbsd.org>
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
-/* $OpenBSD: irr_output.c,v 1.15 2013/11/22 15:15:16 deraadt Exp $ */
+/* $OpenBSD: irr_output.c,v 1.16 2015/01/16 06:40:15 deraadt Exp $ */
/*
* Copyright (c) 2007 Henning Brauer <henning@openbsd.org>
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <err.h>
-/* $OpenBSD: irr_parser.c,v 1.11 2013/11/22 15:15:16 deraadt Exp $ */
+/* $OpenBSD: irr_parser.c,v 1.12 2015/01/16 06:40:15 deraadt Exp $ */
/*
* Copyright (c) 2007 Henning Brauer <henning@openbsd.org>
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <ctype.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "irrfilter.h"
-/* $OpenBSD: irr_prefix.c,v 1.19 2014/10/08 16:15:37 deraadt Exp $ */
+/* $OpenBSD: irr_prefix.c,v 1.20 2015/01/16 06:40:15 deraadt Exp $ */
/*
* Copyright (c) 2007 Henning Brauer <henning@openbsd.org>
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/socket.h>
#include <err.h>
#include <errno.h>
-/* $OpenBSD: irrfilter.c,v 1.4 2007/05/28 23:31:53 henning Exp $ */
+/* $OpenBSD: irrfilter.c,v 1.5 2015/01/16 06:40:15 deraadt Exp $ */
/*
* Copyright (c) 2007 Henning Brauer <henning@openbsd.org>
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
-/* $OpenBSD: timer.c,v 1.15 2012/04/12 17:26:09 claudio Exp $ */
+/* $OpenBSD: timer.c,v 1.16 2015/01/16 06:40:15 deraadt Exp $ */
/*
* Copyright (c) 2003-2007 Henning Brauer <henning@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <stdlib.h>
#include "bgpd.h"
#include "session.h"
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
time_t
getmonotime(void)
{
struct peer_timer *pt;
if ((pt = TAILQ_FIRST(&p->timers)) != NULL && pt->val > 0)
- return (MAX(pt->val - getmonotime(), 0));
+ return (MAXIMUM(pt->val - getmonotime(), 0));
return (-1);
}
-/* $OpenBSD: config.h,v 1.27 2014/05/18 09:29:54 espie Exp $ */
+/* $OpenBSD: config.h,v 1.28 2015/01/16 06:40:16 deraadt Exp $ */
/* $NetBSD: config.h,v 1.30 1997/02/02 21:12:30 thorpej Exp $ */
/*
*/
#include <sys/types.h>
-#include <sys/param.h>
-#if !defined(MAKE_BOOTSTRAP) && defined(BSD)
#include <paths.h>
-#endif /* ...BSD */
-
#include <stdlib.h>
#include <unistd.h>
-/* $OpenBSD: files.c,v 1.19 2012/09/17 17:36:13 espie Exp $ */
+/* $OpenBSD: files.c,v 1.20 2015/01/16 06:40:16 deraadt Exp $ */
/* $NetBSD: files.c,v 1.6 1996/03/17 13:18:17 cgd Exp $ */
/*
* from: @(#)files.c 8.1 (Berkeley) 6/6/93
*/
-#include <sys/param.h>
-
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
%{
-/* $OpenBSD: gram.y,v 1.23 2012/09/17 17:36:13 espie Exp $ */
+/* $OpenBSD: gram.y,v 1.24 2015/01/16 06:40:16 deraadt Exp $ */
/* $NetBSD: gram.y,v 1.14 1997/02/02 21:12:32 thorpej Exp $ */
/*
* from: @(#)gram.y 8.1 (Berkeley) 6/6/93
*/
+#include <sys/param.h> /* NODEV */
#include <sys/types.h>
-#include <sys/param.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
+#include <limits.h>
#include <string.h>
#include <errno.h>
#include "config.h"
static void
setmachine(const char *mch, const char *mcharch)
{
- char buf[MAXPATHLEN];
+ char buf[PATH_MAX];
machine = mch;
machinearch = mcharch;
-/* $OpenBSD: main.c,v 1.47 2014/05/18 09:29:54 espie Exp $ */
+/* $OpenBSD: main.c,v 1.48 2015/01/16 06:40:16 deraadt Exp $ */
/* $NetBSD: main.c,v 1.22 1997/02/02 21:12:33 thorpej Exp $ */
/*
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/param.h>
#include <ctype.h>
#include <err.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "config.h"
mksymlinks(void)
{
int ret;
- char *p, buf[MAXPATHLEN];
+ char *p, buf[PATH_MAX];
const char *q;
snprintf(buf, sizeof buf, "arch/%s/include", machine);
-/* $OpenBSD: mkheaders.c,v 1.20 2013/11/23 17:38:15 deraadt Exp $ */
+/* $OpenBSD: mkheaders.c,v 1.21 2015/01/16 06:40:16 deraadt Exp $ */
/* $NetBSD: mkheaders.c,v 1.12 1997/02/02 21:12:34 thorpej Exp $ */
/*
* from: @(#)mkheaders.c 8.1 (Berkeley) 6/6/93
*/
-#include <sys/param.h>
-
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
-/* $OpenBSD: mkioconf.c,v 1.32 2014/05/18 09:29:54 espie Exp $ */
+/* $OpenBSD: mkioconf.c,v 1.33 2015/01/16 06:40:16 deraadt Exp $ */
/* $NetBSD: mkioconf.c,v 1.41 1996/11/11 14:18:49 mycroft Exp $ */
/*
* from: @(#)mkioconf.c 8.1 (Berkeley) 6/6/93
*/
-#include <sys/param.h>
-
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
-/* $OpenBSD: mkmakefile.c,v 1.40 2014/06/04 07:14:29 jsg Exp $ */
+/* $OpenBSD: mkmakefile.c,v 1.41 2015/01/16 06:40:16 deraadt Exp $ */
/* $NetBSD: mkmakefile.c,v 1.34 1997/02/02 21:12:36 thorpej Exp $ */
/*
* from: @(#)mkmakefile.c 8.1 (Berkeley) 6/6/93
*/
-#include <sys/param.h>
-
#include <ctype.h>
#include <err.h>
#include <errno.h>
-/* $OpenBSD: mkswap.c,v 1.14 2013/04/19 15:03:02 florian Exp $ */
+/* $OpenBSD: mkswap.c,v 1.15 2015/01/16 06:40:16 deraadt Exp $ */
/* $NetBSD: mkswap.c,v 1.5 1996/08/31 20:58:27 mycroft Exp $ */
/*
* from: @(#)mkswap.c 8.1 (Berkeley) 6/6/93
*/
-#include <sys/param.h>
+#include <sys/param.h> /* NODEV */
#include <errno.h>
#include <stdio.h>
-/* $OpenBSD: pack.c,v 1.17 2014/05/18 09:29:54 espie Exp $ */
+/* $OpenBSD: pack.c,v 1.18 2015/01/16 06:40:16 deraadt Exp $ */
/* $NetBSD: pack.c,v 1.5 1996/08/31 21:15:11 mycroft Exp $ */
/*
* from: @(#)pack.c 8.1 (Berkeley) 6/6/93
*/
-#include <sys/param.h>
-
#include <stdlib.h>
#include <string.h>
%{
-/* $OpenBSD: scan.l,v 1.21 2012/09/17 17:36:13 espie Exp $ */
+/* $OpenBSD: scan.l,v 1.22 2015/01/16 06:40:16 deraadt Exp $ */
/* $NetBSD: scan.l,v 1.13 1997/02/02 21:12:37 thorpej Exp $ */
/*
* from: @(#)scan.l 8.1 (Berkeley) 6/6/93
*/
-#include <sys/param.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
-/* $OpenBSD: sem.c,v 1.34 2014/05/18 09:29:54 espie Exp $ */
+/* $OpenBSD: sem.c,v 1.35 2015/01/16 06:40:16 deraadt Exp $ */
/* $NetBSD: sem.c,v 1.10 1996/11/11 23:40:11 gwr Exp $ */
/*
* from: @(#)sem.c 8.1 (Berkeley) 6/6/93
*/
-#include <sys/param.h>
+#include <sys/param.h> /* NODEV */
#include <ctype.h>
#include <err.h>
-/* $OpenBSD: crunchgen.c,v 1.13 2014/01/11 04:44:15 deraadt Exp $ */
+/* $OpenBSD: crunchgen.c,v 1.14 2015/01/16 06:40:16 deraadt Exp $ */
/*
* Copyright (c) 1994 University of Maryland
* Generates a Makefile and main C file for a crunched executable,
* from specs given in a .conf file.
*/
+#include <sys/param.h> /* MACHINE */
+#include <sys/types.h>
+#include <sys/stat.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h>
#include <string.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/param.h>
+#include <limits.h>
#define CRUNCH_VERSION "1.3"
strlst_t *srcdirs = NULL;
strlst_t *libs = NULL;
strlst_t *libdirs = NULL;
-char objdir[MAXPATHLEN] = "obj";
+char objdir[PATH_MAX] = "obj";
prog_t *progs = NULL;
char line[MAXLINELEN];
-char confname[MAXPATHLEN], infilename[MAXPATHLEN];
-char outmkname[MAXPATHLEN], outcfname[MAXPATHLEN];
-char cachename[MAXPATHLEN], curfilename[MAXPATHLEN];
-char topdir[MAXPATHLEN], execfname[MAXPATHLEN];
+char confname[PATH_MAX], infilename[PATH_MAX];
+char outmkname[PATH_MAX], outcfname[PATH_MAX];
+char cachename[PATH_MAX], curfilename[PATH_MAX];
+char topdir[PATH_MAX], execfname[PATH_MAX];
int linenum = -1;
int goterror = 0;
elf_names = 1;
break;
case 'L':
- if (strlen(optarg) >= MAXPATHLEN)
+ if (strlen(optarg) >= PATH_MAX)
usage();
add_string(&libdirs, optarg);
break;
add_srcdirs(int argc, char **argv)
{
int i;
- char tmppath[MAXPATHLEN];
+ char tmppath[PATH_MAX];
int overflow;
for (i = 1; i < argc; i++) {
add_libdirs(int argc, char **argv)
{
int i;
- char tmppath[MAXPATHLEN];
- char tmppath2[MAXPATHLEN];
+ char tmppath[PATH_MAX];
+ char tmppath2[PATH_MAX];
int overflow;
for (i = 1; i < argc; i++) {
void
fillin_program(prog_t * p)
{
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
char *srcparent;
strlst_t *s;
int i;
void
fillin_program_objs(prog_t * p, char *path)
{
- char *cp, *obj, tempfname[MAXPATHLEN];
+ char *cp, *obj, tempfname[PATH_MAX];
int fd, rc;
FILE *f;
char *
dir_search(char *progname)
{
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
strlst_t *dir;
for (dir = srcdirs; dir != NULL; dir = dir->next) {
-/* $OpenBSD: dev_mkdb.c,v 1.12 2013/11/27 13:32:02 okan Exp $ */
+/* $OpenBSD: dev_mkdb.c,v 1.13 2015/01/16 06:40:16 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <db.h>
HASHINFO info;
int ch;
u_char buf[MAXNAMLEN + 1];
- char dbtmp[MAXPATHLEN], dbname[MAXPATHLEN];
+ char dbtmp[PATH_MAX], dbname[PATH_MAX];
while ((ch = getopt(argc, argv, "")) != -1)
switch(ch) {
-/* $OpenBSD: dhcpd.c,v 1.45 2014/07/11 09:42:27 yasuoka Exp $ */
+/* $OpenBSD: dhcpd.c,v 1.46 2015/01/16 06:40:16 deraadt Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@cvs.openbsd.org>
/* from memory.c - needed to be able to walk the lease table */
extern struct subnet *subnets;
+#define MINIMUM(a,b) (((a)<(b))?(a):(b))
+
void
periodic_scan(void *p)
{
struct lease *l;
/* find the shortest lease this server gives out */
- x = MIN(root_group.default_lease_time, root_group.max_lease_time);
+ x = MINIMUM(root_group.default_lease_time, root_group.max_lease_time);
for (n = subnets; n; n = n->next_subnet)
for (g = n->group; g; g = g->next)
- x = MIN(x, g->default_lease_time);
+ x = MINIMUM(x, g->default_lease_time);
/* use half of the shortest lease as the scan interval */
y = x / 2;
-/* $OpenBSD: pfutils.c,v 1.10 2013/10/18 15:19:39 krw Exp $ */
+/* $OpenBSD: pfutils.c,v 1.11 2015/01/16 06:40:16 deraadt Exp $ */
/*
* Copyright (c) 2006 Chris Kuethe <ckuethe@openbsd.org>
*
#include <sys/types.h>
#include <sys/ioctl.h>
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/time.h>
-/* $OpenBSD: sync.c,v 1.15 2013/10/18 15:19:40 krw Exp $ */
+/* $OpenBSD: sync.c,v 1.16 2015/01/16 06:40:16 deraadt Exp $ */
/*
* Copyright (c) 2008 Bob Beck <beck@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/stdint.h>
#include <sys/file.h>
#include <sys/wait.h>
-/* $OpenBSD: udpsock.c,v 1.1 2014/07/11 09:42:27 yasuoka Exp $ */
+/* $OpenBSD: udpsock.c,v 1.2 2015/01/16 06:40:16 deraadt Exp $ */
/*
* Copyright (c) 2014 YASUOKA Masahiko <yasuoka@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* nitems */
#include <sys/socket.h>
#include <sys/uio.h>
#include <sys/ioctl.h>
-/* $OpenBSD: dvmrpd.c,v 1.16 2014/07/12 19:22:32 krw Exp $ */
+/* $OpenBSD: dvmrpd.c,v 1.17 2015/01/16 06:40:16 deraadt Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
#include <sys/queue.h>
#include <sys/time.h>
#include <sys/stat.h>
-#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/wait.h>
-/* $OpenBSD: kroute.c,v 1.8 2014/06/23 03:46:17 guenther Exp $ */
+/* $OpenBSD: kroute.c,v 1.9 2015/01/16 06:40:16 deraadt Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
/*
* Disk quota editor.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* btodb dbtob */
#include <sys/stat.h>
#include <sys/file.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
char *qfname = QUOTAFILENAME;
char *qfextension[] = INITQFNAMES;
struct quotause *next;
long flags;
struct dqblk dqblk;
- char fsname[MAXPATHLEN];
+ char fsname[PATH_MAX];
char qfname[1]; /* actually longer */
} *getprivs(u_int, int);
#define FOUND 0x01
-/* $OpenBSD: main.c,v 1.19 2014/07/24 19:19:26 miod Exp $ */
+/* $OpenBSD: main.c,v 1.20 2015/01/16 06:40:16 deraadt Exp $ */
/* $NetBSD: main.c,v 1.3 1996/05/16 16:00:55 thorpej Exp $ */
/*-
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <err.h>
#include <string.h>
#include <stdio.h>
-/* $OpenBSD: apme.c,v 1.15 2007/02/08 11:15:55 reyk Exp $ */
+/* $OpenBSD: apme.c,v 1.16 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* roundup isclr */
#include <sys/ioctl.h>
-#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/uio.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "hostapd.h"
#include "iapp.h"
-/* $OpenBSD: handle.c,v 1.11 2007/02/08 11:15:55 reyk Exp $ */
+/* $OpenBSD: handle.c,v 1.12 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2005, 2006 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "hostapd.h"
-/* $OpenBSD: hostapd.c,v 1.34 2008/05/12 23:49:28 millert Exp $ */
+/* $OpenBSD: hostapd.c,v 1.35 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/types.h>
+#include <sys/signal.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/queue.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <err.h>
#include "hostapd.h"
-/* $OpenBSD: hostapd.h,v 1.20 2006/12/31 03:25:58 reyk Exp $ */
+/* $OpenBSD: hostapd.h,v 1.21 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@openbsd.org>
#ifndef _HOSTAPD_H
#define _HOSTAPD_H
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/tree.h>
struct event c_priv_ev;
- char c_config[MAXPATHLEN];
+ char c_config[PATH_MAX];
u_int c_verbose;
u_int c_debug;
-/* $OpenBSD: iapp.c,v 1.18 2009/04/16 20:13:13 sobrado Exp $ */
+/* $OpenBSD: iapp.c,v 1.19 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "hostapd.h"
#include "iapp.h"
-/* $OpenBSD: llc.c,v 1.5 2007/02/08 11:15:55 reyk Exp $ */
+/* $OpenBSD: llc.c,v 1.6 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "hostapd.h"
-/* $OpenBSD: parse.y,v 1.48 2014/11/20 05:51:20 jsg Exp $ */
+/* $OpenBSD: parse.y,v 1.49 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2004, 2005, 2006 Reyk Floeter <reyk@openbsd.org>
*/
%{
-#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <stdint.h>
#include <err.h>
-/* $OpenBSD: print-802_11.c,v 1.6 2006/06/26 23:06:07 reyk Exp $ */
+/* $OpenBSD: print-802_11.c,v 1.7 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2005 Reyk Floeter <reyk@openbsd.org>
/* usr.sbin/tcpdump/print-802_11.c,v 1.3 2005/03/09 11:43:17 deraadt Exp */
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/file.h>
#include <pcap.h>
#include <stdio.h>
#include <string.h>
+#include <limits.h>
#include "hostapd.h"
-/* $OpenBSD: privsep.c,v 1.23 2007/05/02 09:09:29 claudio Exp $ */
+/* $OpenBSD: privsep.c,v 1.24 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2004, 2005 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "hostapd.h"
#include "iapp.h"
-/* $OpenBSD: roaming.c,v 1.5 2010/05/26 19:18:10 millert Exp $ */
+/* $OpenBSD: roaming.c,v 1.6 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2005, 2006 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/tree.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
+#include <limits.h>
#include "hostapd.h"
-/* $OpenBSD: httpd.c,v 1.28 2014/12/11 17:06:55 schwarze Exp $ */
+/* $OpenBSD: httpd.c,v 1.29 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2014 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <sys/param.h> /* nitems */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/resource.h>
+#include <sys/signal.h>
#include <net/if.h>
#include <netinet/in.h>
#include "httpd.h"
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
__dead void usage(void);
int parent_configure(struct httpd *);
if (maxfd == -1)
rl.rlim_cur = rl.rlim_max;
else
- rl.rlim_cur = MAX(rl.rlim_max, (rlim_t)maxfd);
+ rl.rlim_cur = MAXIMUM(rl.rlim_max, (rlim_t)maxfd);
if (setrlimit(RLIMIT_NOFILE, &rl) == -1)
fatal("socket_rlimit: failed to set resource limit");
}
-/* $OpenBSD: httpd.h,v 1.67 2015/01/13 09:21:15 reyk Exp $ */
+/* $OpenBSD: httpd.h,v 1.68 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
#include <sys/tree.h>
-#include <sys/param.h> /* MAXHOSTNAMELEN */
#include <limits.h>
#include <imsg.h>
#include <tls.h>
struct server_config {
u_int32_t id;
- char name[MAXHOSTNAMELEN];
+ char name[HOST_NAME_MAX+1];
char location[NAME_MAX];
char index[NAME_MAX];
- char root[MAXPATHLEN];
- char socket[MAXPATHLEN];
+ char root[PATH_MAX];
+ char socket[PATH_MAX];
char accesslog[NAME_MAX];
char errorlog[NAME_MAX];
-/* $OpenBSD: logger.c,v 1.8 2014/12/21 00:54:49 guenther Exp $ */
+/* $OpenBSD: logger.c,v 1.9 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2014 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <sys/param.h> /* nitems */
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/queue.h>
int
logger_open_priv(struct imsg *imsg)
{
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
char name[NAME_MAX], *p;
u_int32_t id;
size_t len;
-/* $OpenBSD: parse.y,v 1.53 2015/01/13 09:21:15 reyk Exp $ */
+/* $OpenBSD: parse.y,v 1.54 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2007 - 2015 Reyk Floeter <reyk@openbsd.org>
struct portrange port;
struct {
struct sockaddr_storage ss;
- char name[MAXHOSTNAMELEN];
+ char name[HOST_NAME_MAX+1];
} addr;
} v;
int lineno;
-/* $OpenBSD: server.c,v 1.51 2015/01/13 09:21:15 reyk Exp $ */
+/* $OpenBSD: server.c,v 1.52 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <sys/param.h> /* nitems */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/time.h>
#include "httpd.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
int server_dispatch_parent(int, struct privsep_proc *,
struct imsg *);
int server_dispatch_logger(int, struct privsep_proc *,
}
if (bufev->wm_read.high != 0)
- howmuch = MIN(sizeof(rbuf), bufev->wm_read.high);
+ howmuch = MINIMUM(sizeof(rbuf), bufev->wm_read.high);
ret = tls_read(clt->clt_tls_ctx, rbuf, howmuch, &len);
if (ret == TLS_READ_AGAIN || ret == TLS_WRITE_AGAIN) {
void
server_log(struct client *clt, const char *msg)
{
- char ibuf[MAXHOSTNAMELEN], obuf[MAXHOSTNAMELEN];
+ char ibuf[HOST_NAME_MAX+1], obuf[HOST_NAME_MAX+1];
struct server_config *srv_conf = clt->clt_srv_conf;
char *ptr = NULL;
int debug_cmd = -1;
-/* $OpenBSD: server_fcgi.c,v 1.45 2015/01/13 08:54:01 reyk Exp $ */
+/* $OpenBSD: server_fcgi.c,v 1.46 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2014 Florian Obser <florian@openbsd.org>
struct http_descriptor *desc = clt->clt_descreq;
struct fcgi_record_header *h;
struct fcgi_begin_request_body *begin;
- char hbuf[MAXHOSTNAMELEN];
+ char hbuf[HOST_NAME_MAX+1];
size_t scriptlen;
int pathlen;
int fd = -1, ret;
-/* $OpenBSD: server_file.c,v 1.46 2015/01/13 09:21:15 reyk Exp $ */
+/* $OpenBSD: server_file.c,v 1.47 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
#include "httpd.h"
#include "http.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
int server_file_access(struct httpd *, struct client *, char *, size_t);
int server_file_request(struct httpd *, struct client *, char *,
struct stat *);
{
struct http_descriptor *desc = clt->clt_descreq;
struct server_config *srv_conf = clt->clt_srv_conf;
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
const char *stripped, *errstr = NULL;
int ret = 500;
media = media_find(env->sc_mediatypes, path);
ret = server_response_http(clt, 200, media, st->st_size,
- MIN(time(NULL), st->st_mtim.tv_sec));
+ MINIMUM(time(NULL), st->st_mtim.tv_sec));
switch (ret) {
case -1:
goto fail;
int
server_file_index(struct httpd *env, struct client *clt, struct stat *st)
{
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
char tmstr[21];
struct http_descriptor *desc = clt->clt_descreq;
struct server_config *srv_conf = clt->clt_srv_conf;
goto abort;
/* Save last modification time */
- dir_mtime = MIN(time(NULL), st->st_mtim.tv_sec);
+ dir_mtime = MINIMUM(time(NULL), st->st_mtim.tv_sec);
if ((evb = evbuffer_new()) == NULL)
goto abort;
if (evbuffer_add_printf(evb,
"<a href=\"%s\">%s/</a>%*s%s%20s\n",
dp->d_name, dp->d_name,
- MAX(namewidth, 0), " ", tmstr, "-") == -1)
+ MAXIMUM(namewidth, 0), " ", tmstr, "-") == -1)
skip = 1;
} else if (S_ISREG(st->st_mode)) {
if (evbuffer_add_printf(evb,
"<a href=\"%s\">%s</a>%*s%s%20llu\n",
dp->d_name, dp->d_name,
- MAX(namewidth, 0), " ", tmstr, st->st_size) == -1)
+ MAXIMUM(namewidth, 0), " ", tmstr, st->st_size) == -1)
skip = 1;
}
free(dp);
-/* $OpenBSD: server_http.c,v 1.63 2015/01/13 09:21:15 reyk Exp $ */
+/* $OpenBSD: server_http.c,v 1.64 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <stdio.h>
#include <err.h>
#include <pwd.h>
const char *
server_http_host(struct sockaddr_storage *ss, char *buf, size_t len)
{
- char hbuf[MAXHOSTNAMELEN];
+ char hbuf[HOST_NAME_MAX+1];
in_port_t port;
if (print_host(ss, buf, len) == NULL)
int
server_response(struct httpd *httpd, struct client *clt)
{
- char path[MAXPATHLEN];
- char hostname[MAXHOSTNAMELEN];
+ char path[PATH_MAX];
+ char hostname[HOST_NAME_MAX+1];
struct http_descriptor *desc = clt->clt_descreq;
struct http_descriptor *resp = clt->clt_descresp;
struct server *srv = clt->clt_srv;
-/* $OpenBSD: identd.c,v 1.26 2014/07/13 17:53:41 claudio Exp $ */
+/* $OpenBSD: identd.c,v 1.27 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2013 David Gwynne <dlg@openbsd.org>
#include <fcntl.h>
#include <pwd.h>
#include <stdio.h>
+#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
void
parent_noident(struct ident_resolver *r, struct passwd *pw)
{
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
struct stat st;
int rv;
-/* $OpenBSD: ikeca.c,v 1.29 2014/08/26 17:47:24 jsing Exp $ */
+/* $OpenBSD: ikeca.c,v 1.30 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2010 Jonathan Gray <jsg@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <fcntl.h>
#include <fts.h>
#include <dirent.h>
+#include <limits.h>
#include <openssl/rand.h>
#include <openssl/rsa.h>
ca_sign(struct ca *ca, char *keyname, int type, char *envargs)
{
char cmd[PATH_MAX * 2];
- char hostname[MAXHOSTNAMELEN];
+ char hostname[HOST_NAME_MAX+1];
char name[128];
strlcpy(name, keyname, sizeof(name));
-/* $OpenBSD: ikectl.c,v 1.18 2013/11/14 20:48:52 deraadt Exp $ */
+/* $OpenBSD: ikectl.c,v 1.19 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2007-2013 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/queue.h>
-/* $OpenBSD: parser.c,v 1.12 2013/01/08 10:38:19 reyk Exp $ */
+/* $OpenBSD: parser.c,v 1.13 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/queue.h>
-/* $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.
*
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <limits.h>
#include <string.h>
#include <login_cap.h>
#include <ifaddrs.h>
#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 */
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",
-/* $OpenBSD: iscsictl.c,v 1.8 2014/04/21 20:20:37 claudio Exp $ */
+/* $OpenBSD: iscsictl.c,v 1.9 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2010 Claudio Jeker <claudio@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/types.h>
-#include <sys/param.h>
+#include <sys/param.h> /* nitems */
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/uio.h>
-/* $OpenBSD: kgmon.c,v 1.20 2013/11/27 13:32:02 okan Exp $ */
+/* $OpenBSD: kgmon.c,v 1.21 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 1983, 1992, 1993
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/file.h>
#include <sys/sysctl.h>
#include <sys/gmon.h>
-/* $OpenBSD: kvm_mkdb.c,v 1.19 2014/12/23 03:29:52 tedu Exp $ */
+/* $OpenBSD: kvm_mkdb.c,v 1.20 2015/01/16 06:40:17 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
struct rlimit rl;
int fd, rval, ch, verbose = 0;
char *nlistpath, *nlistname;
- char dbdir[MAXPATHLEN];
+ char dbdir[PATH_MAX];
/* Increase our data size to the max if we can. */
if (getrlimit(RLIMIT_DATA, &rl) == 0) {
int verbose)
{
DB *db;
- char dbtemp[MAXPATHLEN], dbname[MAXPATHLEN];
+ char dbtemp[PATH_MAX], dbname[PATH_MAX];
int r;
struct group *gr;
-/* $OpenBSD: nlist.c,v 1.45 2014/05/20 01:25:24 guenther Exp $ */
+/* $OpenBSD: nlist.c,v 1.46 2015/01/16 06:40:17 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <a.out.h>
#include <db.h>
-/* $OpenBSD: testdb.c,v 1.8 2009/10/27 23:59:51 deraadt Exp $ */
+/* $OpenBSD: testdb.c,v 1.9 2015/01/16 06:40:17 deraadt Exp $ */
/*-
* Copyright (c) 1992, 1993
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/sysctl.h>
#include <db.h>
-/* $OpenBSD: kroute.c,v 1.33 2014/06/23 03:46:17 guenther Exp $ */
+/* $OpenBSD: kroute.c,v 1.34 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "ldpd.h"
#include "log.h"
-/* $OpenBSD: ldpd.c,v 1.20 2014/07/12 20:16:38 krw Exp $ */
+/* $OpenBSD: ldpd.c,v 1.21 2015/01/16 06:40:17 deraadt Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/wait.h>
-#include <sys/param.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-/* $OpenBSD: common.c,v 1.37 2014/11/02 13:56:55 deraadt Exp $ */
+/* $OpenBSD: common.c,v 1.38 2015/01/16 06:40:17 deraadt Exp $ */
/* $NetBSD: common.c,v 1.21 2000/08/09 14:28:50 itojun Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
+#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-/* $OpenBSD: common_vars.c,v 1.4 2009/10/27 23:59:51 deraadt Exp $ */
+/* $OpenBSD: common_vars.c,v 1.5 2015/01/16 06:40:17 deraadt Exp $ */
/* $NetBSD: common.c,v 1.15 1999/09/26 10:32:27 mrg Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
+#include <limits.h>
#include "pathnames.h"
char *name; /* program name */
char *printer; /* printer name */
-char host[MAXHOSTNAMELEN+1]; /* host machine name */
+char host[HOST_NAME_MAX+1 + 1]; /* host machine name */
char *from = host; /* client's machine name */
char *printcapdb[2] = { _PATH_PRINTCAP, 0 };
char *bp; /* pointer into printcap buffer. */
-/* $OpenBSD: displayq.c,v 1.35 2014/05/21 18:38:42 pascal Exp $ */
+/* $OpenBSD: displayq.c,v 1.36 2015/01/16 06:40:17 deraadt Exp $ */
/* $NetBSD: displayq.c,v 1.21 2001/08/30 00:51:50 itojun Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <errno.h>
#include <dirent.h>
#include <fcntl.h>
+#include <limits.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
-/* $OpenBSD: lp.h,v 1.18 2013/12/10 16:38:04 naddy Exp $ */
+/* $OpenBSD: lp.h,v 1.19 2015/01/16 06:40:17 deraadt Exp $ */
/* $NetBSD: lp.h,v 1.14 2000/04/16 14:43:58 mrg Exp $ */
/*
extern char *bp; /* pointer into printcap buffer */
extern char *printer; /* printer name */
/* host machine name */
-extern char host[MAXHOSTNAMELEN];
+extern char host[HOST_NAME_MAX+1];
extern char *from; /* client's machine name */
extern int remote; /* true if sending files to a remote host */
extern char *printcapdb[]; /* printcap database array */
-/* $OpenBSD: rmjob.c,v 1.21 2013/11/24 21:32:32 deraadt Exp $ */
+/* $OpenBSD: rmjob.c,v 1.22 2015/01/16 06:40:17 deraadt Exp $ */
/* $NetBSD: rmjob.c,v 1.16 2000/04/16 14:43:58 mrg Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
-
#include <signal.h>
#include <errno.h>
#include <fcntl.h>
#include <dirent.h>
#include <unistd.h>
+#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-/* $OpenBSD: startdaemon.c,v 1.14 2014/07/20 01:38:40 guenther Exp $ */
+/* $OpenBSD: startdaemon.c,v 1.15 2015/01/16 06:40:17 deraadt Exp $ */
/* $NetBSD: startdaemon.c,v 1.10 1998/07/18 05:04:39 lukem Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
+#include <limits.h>
#include <string.h>
#include <signal.h>
-/* $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 $ */
/*
* lpc -- line printer control program -- commands:
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/file.h>
#include <errno.h>
#include <dirent.h>
#include <unistd.h>
+#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
upstat(char *msg)
{
int fd;
- char statfile[MAXPATHLEN];
+ char statfile[PATH_MAX];
if (cgetstr(bp, "st", &ST) == -1)
ST = DEFSTAT;
-/* $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 $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
-
#include <dirent.h>
#include <signal.h>
#include <syslog.h>
#include <stdio.h>
#include <err.h>
#include <errno.h>
+#include <limits.h>
#include <ctype.h>
#include <string.h>
#include <grp.h>
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;
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;
-/* $OpenBSD: key.c,v 1.7 2009/10/27 23:59:52 deraadt Exp $ */
+/* $OpenBSD: key.c,v 1.8 2015/01/16 06:40:18 deraadt Exp $ */
/* $NetBSD: key.c,v 1.3 1997/10/20 08:08:28 scottr Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <errno.h>
+#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <syslog.h>
#include <dirent.h>
+#include <limits.h>
#include <termios.h>
#include "lp.h"
-/* $OpenBSD: lpd.c,v 1.56 2014/10/17 06:11:27 deraadt Exp $ */
+/* $OpenBSD: lpd.c,v 1.57 2015/01/16 06:40:18 deraadt Exp $ */
/* $NetBSD: lpd.c,v 1.33 2002/01/21 14:42:29 wiz Exp $ */
/*
* Users can't touch the spool w/o the help of one of the lp* programs.
*/
-#include <sys/param.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
+#include <limits.h>
#include "lp.h"
#include "lp.local.h"
-/* $OpenBSD: modes.c,v 1.7 2009/10/27 23:59:52 deraadt Exp $ */
+/* $OpenBSD: modes.c,v 1.8 2015/01/16 06:40:18 deraadt Exp $ */
/* $NetBSD: modes.c,v 1.3 1997/10/20 08:08:31 scottr Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <stddef.h>
#include <string.h>
-/* $OpenBSD: printjob.c,v 1.53 2014/12/16 03:35:49 millert Exp $ */
+/* $OpenBSD: printjob.c,v 1.54 2015/01/16 06:40:18 deraadt Exp $ */
/* $NetBSD: printjob.c,v 1.31 2002/01/21 14:42:30 wiz Exp $ */
/*
* it does not need to be removed because file locks are dynamic.
*/
-#include <sys/param.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
+#include <limits.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
static int tof; /* true if at top of form */
static char class[32]; /* classification field */
-static char fromhost[MAXHOSTNAMELEN]; /* user's host machine */
+static char fromhost[HOST_NAME_MAX+1]; /* user's host machine */
/* indentation size in static characters */
static char indent[10] = "-i0";
static char jobname[NAME_MAX]; /* job or file name */
static char length[10] = "-l"; /* page length in lines */
-static char logname[MAXLOGNAME]; /* user's login name */
+static char logname[LOGIN_NAME_MAX];/* user's login name */
static char pxlength[10] = "-y"; /* page length in pixels */
static char pxwidth[10] = "-x"; /* page width in pixels */
static char tempfile[] = "errsXXXXXXXXXX"; /* file name for filter output */
-/* $OpenBSD: recvjob.c,v 1.25 2009/10/27 23:59:52 deraadt Exp $ */
+/* $OpenBSD: recvjob.c,v 1.26 2015/01/16 06:40:18 deraadt Exp $ */
/* $NetBSD: recvjob.c,v 1.14 2001/12/04 22:52:44 christos Exp $ */
/*
* Receive printer jobs from the network, queue them and
* start the printer daemon.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
+#include <limits.h>
#include "lp.h"
#include "lp.local.h"
#include "extern.h"
-/* $OpenBSD: lpq.c,v 1.20 2013/11/24 21:32:32 deraadt Exp $ */
+/* $OpenBSD: lpq.c,v 1.21 2015/01/16 06:40:18 deraadt Exp $ */
/* $NetBSD: lpq.c,v 1.9 1999/12/07 14:54:47 mrg Exp $ */
/*
* -P used to identify printer as per lpr/lprm
*/
-#include <sys/param.h>
#include <ctype.h>
+#include <signal.h>
#include <dirent.h>
#include <err.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
+#include <limits.h>
#include <syslog.h>
#include "lp.h"
-/* $OpenBSD: lpr.c,v 1.46 2014/05/20 01:25:24 guenther Exp $ */
+/* $OpenBSD: lpr.c,v 1.47 2015/01/16 06:40:18 deraadt Exp $ */
/* $NetBSD: lpr.c,v 1.19 2000/10/11 20:23:52 is Exp $ */
/*
* using information from a printer data base.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/file.h>
#include <pwd.h>
#include <grp.h>
#include <unistd.h>
+#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
struct passwd *pw;
struct group *gptr;
char *arg, *cp;
- char buf[MAXPATHLEN];
+ char buf[PATH_MAX];
int i, f, ch;
struct stat stb;
linked(char *file)
{
char *cp;
- static char buf[MAXPATHLEN];
+ static char buf[PATH_MAX];
int ret;
if (*file != '/') {
-/* $OpenBSD: lprm.c,v 1.20 2014/01/22 19:31:00 tobias Exp $ */
+/* $OpenBSD: lprm.c,v 1.21 2015/01/16 06:40:18 deraadt Exp $ */
/* $$NetBSD: lprm.c,v 1.9 1999/08/16 03:12:32 simonb Exp $ */
/*
* entries, otherwise one can only remove their own.
*/
-#include <sys/param.h>
#include <ctype.h>
+#include <signal.h>
#include <dirent.h>
#include <err.h>
#include <errno.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
+#include <limits.h>
#include "lp.h"
#include "lp.local.h"
char *user[MAXUSERS]; /* users to process */
int users; /* # of users in user array */
volatile sig_atomic_t gotintr; /* set when we receive SIGINT */
-static char luser[MAXLOGNAME]; /* buffer for person */
+static char luser[LOGIN_NAME_MAX]; /* buffer for person */
static __dead void usage(void);
-/* $OpenBSD: mapper.c,v 1.21 2014/11/26 18:34:51 millert Exp $ */
+/* $OpenBSD: mapper.c,v 1.22 2015/01/16 06:40:18 deraadt Exp $ */
/* $NetBSD: mapper.c,v 1.3 1995/12/10 11:12:04 mycroft Exp $ */
/* Mapper for connections between MRouteD multicast routers.
#include <arpa/inet.h>
#include <stdarg.h>
#include <poll.h>
+#include <limits.h>
#include <err.h>
#define DEFAULT_TIMEOUT 2 /* How long to wait before retrying requests */
{
Interface *ifc;
Neighbor *nb;
- char name[MAXHOSTNAMELEN];
+ char name[HOST_NAME_MAX+1];
if (node) {
graph_edges(node->left);
memset(&addr, 0, sizeof addr);
addr.sin_family = AF_INET;
-#if (defined(BSD) && (BSD >= 199103))
addr.sin_len = sizeof addr;
-#endif
addr.sin_addr.s_addr = dvmrp_group;
addr.sin_port = htons(2000); /* any port over 1024 will do... */
if ((udp = socket(AF_INET, SOCK_DGRAM, 0)) < 0
#include <arpa/inet.h>
#include <stdarg.h>
#include <poll.h>
+#include <limits.h>
#include <err.h>
#define DEFAULT_TIMEOUT 4 /* How long to wait before retrying requests */
addrlen = sizeof(addr);
memset(&addr, 0, sizeof addr);
addr.sin_family = AF_INET;
-#if (defined(BSD) && (BSD >= 199103))
addr.sin_len = sizeof addr;
-#endif
addr.sin_addr.s_addr = target_addr;
addr.sin_port = htons(2000); /* any port over 1024 will
* do... */
#include <syslog.h>
#include <signal.h>
#include <string.h>
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
extern char s3[];
extern char s4[];
-#if !(defined(BSD) && (BSD >= 199103))
-extern int errno;
-extern int sys_nerr;
-extern char * sys_errlist[];
-#endif
-
#ifdef OLD_KERNEL
#define MRT_INIT DVMRP_INIT
#define MRT_DONE DVMRP_DONE
bzero(&sdst, sizeof(sdst));
sdst.sin_family = AF_INET;
-#if (defined(BSD) && (BSD >= 199103))
sdst.sin_len = sizeof(sdst);
-#endif
sdst.sin_addr.s_addr = dst;
if (sendto(igmp_socket, send_buf, ntohs(ip->ip_len), 0,
(struct sockaddr *)&sdst, sizeof(sdst)) < 0) {
#define _PATH_MROUTED_CONF "/etc/mrouted.conf"
-#if (defined(BSD) && (BSD >= 199103))
#define _PATH_MROUTED_GENID "/var/run/mrouted.genid"
#define _PATH_MROUTED_DUMP "/var/tmp/mrouted.dump"
#define _PATH_MROUTED_CACHE "/var/tmp/mrouted.cache"
-#else
-#define _PATH_MROUTED_GENID "/etc/mrouted.genid"
-#define _PATH_MROUTED_DUMP "/usr/tmp/mrouted.dump"
-#define _PATH_MROUTED_CACHE "/usr/tmp/mrouted.cache"
-#endif
-/* $OpenBSD: rsrr.c,v 1.12 2013/04/21 06:42:43 tedu Exp $ */
+/* $OpenBSD: rsrr.c,v 1.13 2015/01/16 06:40:18 deraadt Exp $ */
/* $NetBSD: rsrr.c,v 1.3 1995/12/10 10:07:14 mycroft Exp $ */
/*
#ifdef RSRR
#include "defs.h"
-#include <sys/param.h>
-#if (defined(BSD) && (BSD >= 199103))
#include <stddef.h>
-#endif
/* Taken from prune.c */
/*
bzero((char *) &serv_addr, sizeof(serv_addr));
serv_addr.sun_family = AF_UNIX;
strlcpy(serv_addr.sun_path, RSRR_SERV_PATH, sizeof serv_addr.sun_path);
-#if (defined(BSD) && (BSD >= 199103))
servlen = offsetof(struct sockaddr_un, sun_path) +
strlen(serv_addr.sun_path);
serv_addr.sun_len = servlen;
-#else
- servlen = sizeof(serv_addr.sun_family) + strlen(serv_addr.sun_path);
-#endif
if (bind(rsrr_socket, (struct sockaddr *) &serv_addr, servlen) < 0)
logit(LOG_ERR, errno, "Can't bind RSRR socket");
memset(&addr, 0, sizeof addr);
addr.sin_family = AF_INET;
-#if (defined(BSD) && (BSD >= 199103))
addr.sin_len = sizeof addr;
-#endif
addr.sin_addr.s_addr = dst;
addr.sin_port = htons(2000); /* any port over 1024 will do... */
if ((udp = socket(AF_INET, SOCK_DGRAM, 0)) < 0
memset(&addr, 0, sizeof addr);
addr.sin_family = AF_INET;
-#if (defined(BSD) && (BSD >= 199103))
addr.sin_len = sizeof addr;
-#endif
addr.sin_addr.s_addr = dst;
addr.sin_port = htons(2000); /* any port over 1024 will do... */
if ((udp = socket(AF_INET, SOCK_DGRAM, 0)) < 0
-/* $OpenBSD: mtrace.c,v 1.32 2013/11/24 00:54:12 deraadt Exp $ */
+/* $OpenBSD: mtrace.c,v 1.33 2015/01/16 06:40:18 deraadt Exp $ */
/* $NetBSD: mtrace.c,v 1.5 1995/12/10 10:57:15 mycroft Exp $ */
/*
*/
memset(&addr, 0, sizeof addr);
addr.sin_family = AF_INET;
-#if (defined(BSD) && (BSD >= 199103))
addr.sin_len = sizeof(addr);
-#endif
addr.sin_addr.s_addr = qgrp;
addr.sin_port = htons(2000); /* Any port above 1024 will do */
* mtrace -i [if_addr] will have to be used.
*/
if (addr.sin_addr.s_addr == 0) {
- char myhostname[MAXHOSTNAMELEN];
+ char myhostname[HOST_NAME_MAX+1];
struct hostent *hp;
int error;
/* $NetBSD: compare.c,v 1.11 1996/09/05 09:56:48 mycroft Exp $ */
-/* $OpenBSD: compare.c,v 1.23 2012/07/08 21:19:42 naddy Exp $ */
+/* $OpenBSD: compare.c,v 1.24 2015/01/16 06:40:18 deraadt Exp $ */
/*-
* Copyright (c) 1989, 1993
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <fts.h>
#include <stdio.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include <md5.h>
#include <rmd160.h>
#include <sha1.h>
char *
rlink(char *name)
{
- static char lbuf[MAXPATHLEN];
+ static char lbuf[PATH_MAX];
int len;
if ((len = readlink(name, lbuf, sizeof(lbuf)-1)) == -1)
/* $NetBSD: create.c,v 1.11 1996/09/05 09:24:19 mycroft Exp $ */
-/* $OpenBSD: create.c,v 1.29 2013/08/22 04:43:41 guenther Exp $ */
+/* $OpenBSD: create.c,v 1.30 2015/01/16 06:40:18 deraadt Exp $ */
/*-
* Copyright (c) 1989, 1993
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <time.h>
#include <fcntl.h>
#include <pwd.h>
#include <errno.h>
#include <unistd.h>
+#include <limits.h>
#include <stdio.h>
#include <stdarg.h>
#include <vis.h>
extern int ftsoptions;
extern int dflag, iflag, nflag, sflag;
extern u_int keys;
-extern char fullpath[MAXPATHLEN];
+extern char fullpath[PATH_MAX];
static gid_t gid;
static uid_t uid;
FTS *t;
FTSENT *p;
time_t clock;
- char *argv[2], host[MAXHOSTNAMELEN];
+ char *argv[2], host[HOST_NAME_MAX+1];
int indent = 0;
(void)time(&clock);
-/* $OpenBSD: mtree.c,v 1.21 2013/11/27 13:32:02 okan Exp $ */
+/* $OpenBSD: mtree.c,v 1.22 2015/01/16 06:40:18 deraadt Exp $ */
/* $NetBSD: mtree.c,v 1.7 1996/09/05 23:29:22 thorpej Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <errno.h>
#include <unistd.h>
#include <stdio.h>
+#include <limits.h>
#include <fts.h>
#include "mtree.h"
#include "extern.h"
int cflag, dflag, eflag, iflag, lflag, nflag, qflag, rflag, sflag, tflag,
uflag, Uflag;
u_int keys;
-char fullpath[MAXPATHLEN];
+char fullpath[PATH_MAX];
static void usage(void);
-/* $OpenBSD: verify.c,v 1.19 2009/10/27 23:59:53 deraadt Exp $ */
+/* $OpenBSD: verify.c,v 1.20 2015/01/16 06:40:18 deraadt Exp $ */
/* $NetBSD: verify.c,v 1.10 1995/03/07 21:26:28 cgd Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <dirent.h>
#include <fts.h>
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
+#include <limits.h>
#include "mtree.h"
#include "extern.h"
extern u_int32_t crc_total;
extern int ftsoptions;
extern int dflag, eflag, qflag, rflag, sflag, uflag;
-extern char fullpath[MAXPATHLEN];
+extern char fullpath[PATH_MAX];
static NODE *root;
-static char path[MAXPATHLEN];
+static char path[PATH_MAX];
static void miss(NODE *, char *, size_t);
static int vwalk(void);
-/* $OpenBSD: ndp.c,v 1.58 2014/09/07 22:40:30 bluhm Exp $ */
+/* $OpenBSD: ndp.c,v 1.59 2015/01/16 06:40:18 deraadt Exp $ */
/* $KAME: ndp.c,v 1.101 2002/07/17 08:46:33 itojun Exp $ */
/*
*/
-#include <sys/param.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
-/* $OpenBSD: kroute.c,v 1.44 2014/06/23 03:46:17 guenther Exp $ */
+/* $OpenBSD: kroute.c,v 1.45 2015/01/16 06:40:19 deraadt Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "ospf6d.h"
#include "ospfe.h"
-/* $OpenBSD: ospf6d.c,v 1.25 2014/07/12 20:16:38 krw Exp $ */
+/* $OpenBSD: ospf6d.c,v 1.26 2015/01/16 06:40:19 deraadt Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/wait.h>
-#include <sys/param.h>
#include <sys/sysctl.h>
#include <netinet/in.h>
-/* $OpenBSD: rde.c,v 1.62 2014/07/12 20:16:38 krw Exp $ */
+/* $OpenBSD: rde.c,v 1.63 2015/01/16 06:40:19 deraadt Exp $ */
/*
* Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h> /* for MIN() */
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/queue.h>
#include "log.h"
#include "rde.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
void rde_sig_handler(int sig, short, void *);
void rde_shutdown(void);
void rde_dispatch_imsg(int, short, void *);
p = a->prefix;
q = b->prefix;
- len = MIN(LSA_PREFIXSIZE(p->prefixlen), LSA_PREFIXSIZE(q->prefixlen));
+ len = MINIMUM(LSA_PREFIXSIZE(p->prefixlen), LSA_PREFIXSIZE(q->prefixlen));
i = memcmp(p + 1, q + 1, len);
if (i)
-/* $OpenBSD: kroute.c,v 1.94 2014/06/23 03:46:17 guenther Exp $ */
+/* $OpenBSD: kroute.c,v 1.95 2015/01/16 06:40:19 deraadt Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "ospfd.h"
#include "log.h"
-/* $OpenBSD: ospfd.c,v 1.81 2014/07/12 20:16:38 krw Exp $ */
+/* $OpenBSD: ospfd.c,v 1.82 2015/01/16 06:40:19 deraadt Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/wait.h>
-#include <sys/param.h>
#include <sys/sysctl.h>
#include <netinet/in.h>
-/* $OpenBSD: pcidump.c,v 1.36 2014/05/20 01:25:24 guenther Exp $ */
+/* $OpenBSD: pcidump.c,v 1.37 2015/01/16 06:40:19 deraadt Exp $ */
/*
* Copyright (c) 2006, 2007 David Gwynne <loki@animata.net>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <sys/types.h>
#include <sys/ioctl.h>
-#include <sys/param.h>
#include <sys/pciio.h>
#include <dev/pci/pcireg.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#define PCIDEV "/dev/pci"
{
int nfuncs;
int bus, dev, func;
- char pcidev[MAXPATHLEN] = PCIDEV;
+ char pcidev[PATH_MAX] = PCIDEV;
char *romfile = NULL;
const char *errstr;
int c, error = 0, dumpall = 1, domid = 0;
-/* $OpenBSD: auth.c,v 1.33 2014/11/13 06:19:51 schwarze Exp $ */
+/* $OpenBSD: auth.c,v 1.34 2015/01/16 06:40:19 deraadt Exp $ */
/*
* auth.c - PPP authentication and phase control.
#include <stddef.h>
#include <stdlib.h>
#include <unistd.h>
+#include <limits.h>
#include <syslog.h>
#include <pwd.h>
#include <string.h>
/* Default our_name to hostname, and user to our_name */
if (our_name[0] == 0 || usehostname)
- strlcpy(our_name, hostname, MAXHOSTNAMELEN);
+ strlcpy(our_name, hostname, HOST_NAME_MAX+1);
if (user[0] == 0)
strlcpy(user, our_name, MAXNAMELEN);
-/* $OpenBSD: demand.c,v 1.10 2011/04/30 18:49:38 nicm Exp $ */
+/* $OpenBSD: demand.c,v 1.11 2015/01/16 06:40:19 deraadt Exp $ */
/*
* demand.c - Support routines for demand-dialling.
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <syslog.h>
-#include <netdb.h>
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <net/bpf.h>
#include <pcap.h>
#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <syslog.h>
#include "pppd.h"
#include "fsm.h"
-/* $OpenBSD: ipcp.c,v 1.13 2010/05/10 02:00:50 krw Exp $ */
+/* $OpenBSD: ipcp.c,v 1.14 2015/01/16 06:40:19 deraadt Exp $ */
/*
* ipcp.c - PPP IP Control Protocol.
* TODO:
*/
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
#include <netdb.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
#include "pppd.h"
#include "fsm.h"
-/* $OpenBSD: main.c,v 1.50 2014/10/08 04:51:29 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.51 2015/01/16 06:40:19 deraadt Exp $ */
/*
* main.c - Point-to-Point Protocol main module
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <sys/stat.h>
+#include <sys/socket.h>
+#include <net/if.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <signal.h>
#include <errno.h>
#include <fcntl.h>
#include <netdb.h>
#include <utmp.h>
#include <pwd.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/time.h>
-#include <sys/resource.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <net/if.h>
#include "pppd.h"
#include "magic.h"
int ifunit; /* Interface unit number */
char *progname; /* Name of this program */
-char hostname[MAXHOSTNAMELEN]; /* Our hostname */
-static char pidfilename[MAXPATHLEN]; /* name of pid file */
-static char default_devnam[MAXPATHLEN]; /* name of default device */
+char hostname[HOST_NAME_MAX+1]; /* Our hostname */
+static char pidfilename[PATH_MAX]; /* name of pid file */
+static char default_devnam[PATH_MAX]; /* name of default device */
static pid_t pid; /* Our pid */
static uid_t uid; /* Our real user-id */
static int conn_running; /* we have a [dis]connector running */
phase = PHASE_INITIALIZE;
p = ttyname(0);
if (p)
- strlcpy(devnam, p, MAXPATHLEN);
+ strlcpy(devnam, p, PATH_MAX);
strlcpy(default_devnam, devnam, sizeof default_devnam);
script_env = NULL;
dup2 (0, 2); /* stderr -> /dev/null */
}
-#ifdef BSD
/* Force the priority back to zero if pppd is running higher. */
if (setpriority (PRIO_PROCESS, 0, 0) < 0)
syslog (LOG_WARNING, "can't reset priority to 0: %m");
-#endif
/* SysV recommends a second fork at this point. */
-/* $OpenBSD: options.c,v 1.27 2014/12/10 03:39:54 jsg Exp $ */
+/* $OpenBSD: options.c,v 1.28 2015/01/16 06:40:19 deraadt Exp $ */
/*
* options.c - handles option processing for PPP.
int debug = 0; /* Debug flag */
int kdebugflag = 0; /* Tell kernel to print debug messages */
int default_device = 1; /* Using /dev/tty or equivalent */
-char devnam[MAXPATHLEN] = "/dev/tty"; /* Device name */
+char devnam[PATH_MAX] = "/dev/tty"; /* Device name */
int crtscts = 0; /* Use hardware flow control */
int modem = 1; /* Use modem control lines */
int modem_chat = 0; /* Use modem control lines during chat */
int quiet;
{
struct stat statbuf;
- char dev[MAXPATHLEN];
+ char dev[PATH_MAX];
if (*cp == 0)
return 0;
return -1;
}
- (void) strlcpy(devnam, cp, MAXPATHLEN);
+ (void) strlcpy(devnam, cp, PATH_MAX);
default_device = FALSE;
devnam_info.priv = privileged_option;
devnam_info.source = option_source;
-/* $OpenBSD: pppd.h,v 1.17 2011/04/30 18:49:38 nicm Exp $ */
+/* $OpenBSD: pppd.h,v 1.18 2015/01/16 06:40:19 deraadt Exp $ */
/*
* pppd.h - PPP daemon global declarations.
#ifndef __PPPD_H__
#define __PPPD_H__
-#include <stdio.h> /* for FILE */
-#include <stdarg.h>
-#include <sys/param.h> /* for MAXPATHLEN and BSD4_4, if defined */
#include <sys/types.h> /* for u_int32_t, if defined */
#include <sys/time.h> /* for struct timeval */
#include <net/ppp_defs.h>
+#include <stdio.h> /* for FILE */
+#include <stdarg.h>
/*
* Limits.
-/* $OpenBSD: pppstats.c,v 1.10 2009/10/27 23:59:53 deraadt Exp $ */
+/* $OpenBSD: pppstats.c,v 1.11 2015/01/16 06:40:19 deraadt Exp $ */
/*
* print PPP statistics:
* SUCH DAMAGE.
*/
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <net/ppp_defs.h>
+#include <net/if.h>
+#include <net/if_ppp.h>
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <fcntl.h>
#include <err.h>
#include <unistd.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <net/ppp_defs.h>
-#include <net/if.h>
-#include <net/if_ppp.h>
int vflag, rflag, zflag; /* select type of display */
int aflag; /* print absolute values, not deltas */
-/* $OpenBSD: procmap.c,v 1.57 2014/11/16 12:31:01 deraadt Exp $ */
+/* $OpenBSD: procmap.c,v 1.58 2015/01/16 06:40:19 deraadt Exp $ */
/* $NetBSD: pmap.c,v 1.1 2002/09/01 20:32:44 atatat Exp $ */
/*
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/param.h> /* MAXCOMLEN */
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/exec.h>
#include <sys/proc.h>
-/* $OpenBSD: pstat.c,v 1.96 2014/12/19 14:12:00 tedu Exp $ */
+/* $OpenBSD: pstat.c,v 1.97 2015/01/16 06:40:19 deraadt Exp $ */
/* $NetBSD: pstat.c,v 1.27 1996/10/23 22:50:06 cgd Exp $ */
/*-
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXCOMLEN DEV_BSIZE */
+#include <sys/types.h>
#include <sys/proc.h>
#include <sys/time.h>
#include <sys/vnode.h>
-/* $OpenBSD: pwd_mkdb.c,v 1.45 2014/08/25 07:50:26 doug Exp $ */
+/* $OpenBSD: pwd_mkdb.c,v 1.46 2015/01/16 06:40:19 deraadt Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXBSIZE */
#include <sys/stat.h>
#include <db.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <util.h>
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
#define INSECURE 1
#define SECURE 2
#define PERM_INSECURE (S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)
uid_t olduid;
gid_t shadow;
int ch, tfd, makeold, secureonly, flags, checkonly;
- char *username, buf[MAX(MAXPATHLEN, LINE_MAX * 2)];
+ char *username, buf[MAX(PATH_MAX, LINE_MAX * 2)];
flags = checkonly = makeold = secureonly = 0;
username = NULL;
break;
case 'd':
basedir = optarg;
- if (strlen(basedir) > MAXPATHLEN - 40)
+ if (strlen(basedir) > PATH_MAX - 40)
errx(1, "basedir too long");
break;
case 'p': /* create V7 "file.orig" */
/* Tweak openinfo values for large passwd files. */
if (st.st_size > (off_t)100*1024)
- openinfo.cachesize = MIN(st.st_size * 20, (off_t)12*1024*1024);
+ openinfo.cachesize = MINIMUM(st.st_size * 20, (off_t)12*1024*1024);
if (st.st_size / 128 > openinfo.nelem)
openinfo.nelem = st.st_size / 128;
void
mv(char *from, char *to)
{
- char buf[MAXPATHLEN * 2];
+ char buf[PATH_MAX * 2];
if (rename(from, to)) {
int sverrno = errno;
void
cleanup(void)
{
- char buf[MAXPATHLEN];
+ char buf[PATH_MAX];
if (clean & FILE_ORIG) {
(void)snprintf(buf, sizeof(buf), "%s.orig", pname);
char *
changedir(char *path, char *dir)
{
- static char fixed[MAXPATHLEN];
+ static char fixed[PATH_MAX];
char *p;
if (!dir)
-/* $OpenBSD: quot.c,v 1.24 2013/11/12 22:27:12 deraadt Exp $ */
+/* $OpenBSD: quot.c,v 1.25 2015/01/16 06:40:19 deraadt Exp $ */
/*
* Copyright (C) 1991, 1994 Wolfgang Solfrank.
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG DEV_BSIZE MAXBSIZE */
#include <sys/mount.h>
#include <sys/time.h>
#include <ufs/ufs/dinode.h>
/*
* Turn quota on/off for a filesystem.
*/
-#include <sys/param.h>
#include <sys/file.h>
#include <sys/mount.h>
#include <ufs/ufs/quota.h>
-/* $OpenBSD: arptab.c,v 1.22 2013/11/12 19:49:42 deraadt Exp $ */
+/* $OpenBSD: arptab.c,v 1.23 2015/01/16 06:40:19 deraadt Exp $ */
/*
* Copyright (c) 1984, 1993
*/
-#include <sys/param.h>
#include <sys/file.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
-/* $OpenBSD: rarpd.c,v 1.57 2014/12/16 03:35:49 millert Exp $ */
+/* $OpenBSD: rarpd.c,v 1.58 2015/01/16 06:40:19 deraadt Exp $ */
/* $NetBSD: rarpd.c,v 1.25 1998/04/23 02:48:33 mrg Exp $ */
/*
* rarpd - Reverse ARP Daemon
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <syslog.h>
-#include <string.h>
-#include <stdarg.h>
-#include <sys/param.h>
-#include <unistd.h>
#include <sys/time.h>
-#include <net/bpf.h>
+#include <sys/file.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
+#include <net/bpf.h>
#include <net/if.h>
#include <net/if_dl.h>
#include <net/if_types.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>
-#include <sys/file.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <syslog.h>
+#include <string.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <limits.h>
#include <errno.h>
#include <netdb.h>
#include <arpa/inet.h>
void
rarp_process(struct if_info *ii, u_char *pkt)
{
- char ename[MAXHOSTNAMELEN];
+ char ename[HOST_NAME_MAX+1];
u_int32_t target_ipaddr;
struct ether_header *ep;
struct ether_addr *ea;
-/* $OpenBSD: bpf.c,v 1.20 2014/11/02 02:44:50 deraadt Exp $ */
+/* $OpenBSD: bpf.c,v 1.21 2015/01/16 06:40:19 deraadt Exp $ */
/* $NetBSD: bpf.c,v 1.5.2.1 1995/11/14 08:45:42 thorpej Exp $ */
/*
* Author: Jeff Forys, University of Utah CSS
*/
-#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
-/* $OpenBSD: conf.c,v 1.7 2009/10/27 23:59:54 deraadt Exp $ */
+/* $OpenBSD: conf.c,v 1.8 2015/01/16 06:40:19 deraadt Exp $ */
/* $NetBSD: conf.c,v 1.5 1995/10/06 05:12:13 thorpej Exp $ */
/*
* Author: Jeff Forys, University of Utah CSS
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <stdio.h>
+#include <limits.h>
#include "defs.h"
#include "pathnames.h"
** simplify the boot file search code.
*/
-char MyHost[MAXHOSTNAMELEN]; /* host name */
+char MyHost[HOST_NAME_MAX+1]; /* host name */
int DebugFlg = 0; /* set true if debugging */
int BootAny = 0; /* set true if we boot anyone */
-/* $OpenBSD: defs.h,v 1.8 2013/04/20 20:17:17 miod Exp $ */
+/* $OpenBSD: defs.h,v 1.9 2015/01/16 06:40:19 deraadt Exp $ */
/* $NetBSD: defs.h,v 1.5 1995/10/06 05:12:14 thorpej Exp $ */
/*
** include this.
*/
-/*
- * This may be defined in <sys/param.h>, if not, it's defined here.
- */
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 64
-#endif
-
/*
* SIGUSR1 and SIGUSR2 are defined in <signal.h> for 4.3BSD systems.
*/
-/* $OpenBSD: parseconf.c,v 1.11 2013/11/28 18:26:46 deraadt Exp $ */
+/* $OpenBSD: parseconf.c,v 1.12 2015/01/16 06:40:19 deraadt Exp $ */
/* $NetBSD: parseconf.c,v 1.4 1995/10/06 05:12:16 thorpej Exp $ */
/*
* Author: Jeff Forys, University of Utah CSS
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <ctype.h>
-/* $OpenBSD: rbootd.c,v 1.25 2014/05/17 21:37:51 chl Exp $ */
+/* $OpenBSD: rbootd.c,v 1.26 2015/01/16 06:40:19 deraadt Exp $ */
/* $NetBSD: rbootd.c,v 1.5 1995/10/06 05:12:17 thorpej Exp $ */
/*
* Author: Jeff Forys, University of Utah CSS
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <ctype.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
+#include <limits.h>
#include <util.h>
#include <pwd.h>
#include <poll.h>
(void) signal(SIGINT, Exit);
(void) signal(SIGTERM, Exit);
- gethostname(MyHost, MAXHOSTNAMELEN);
+ gethostname(MyHost, HOST_NAME_MAX+1);
if (pidfile(NULL) < 0)
syslog(LOG_WARNING, "pidfile: failed");
-/* $OpenBSD: rmpproto.c,v 1.10 2009/10/27 23:59:54 deraadt Exp $ */
+/* $OpenBSD: rmpproto.c,v 1.11 2015/01/16 06:40:19 deraadt Exp $ */
/* $NetBSD: rmpproto.c,v 1.5.2.1 1995/11/14 08:45:44 thorpej Exp $ */
/*
* Author: Jeff Forys, University of Utah CSS
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <errno.h>
-/* $OpenBSD: utils.c,v 1.12 2013/08/22 04:43:41 guenther Exp $ */
+/* $OpenBSD: utils.c,v 1.13 2015/01/16 06:40:19 deraadt Exp $ */
/* $NetBSD: utils.c,v 1.5.2.1 1995/11/14 08:45:46 thorpej Exp $ */
/*
* Author: Jeff Forys, University of Utah CSS
*/
-#include <sys/param.h>
-
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
-/* $OpenBSD: ntp.c,v 1.32 2014/10/29 04:00:44 deraadt Exp $ */
+/* $OpenBSD: ntp.c,v 1.33 2015/01/16 06:40:20 deraadt Exp $ */
/*
* Copyright (c) 1996, 1997 by N.M. Maclaren. All rights reserved.
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
-/* $OpenBSD: rdate.c,v 1.30 2013/11/12 22:27:13 deraadt Exp $ */
+/* $OpenBSD: rdate.c,v 1.31 2015/01/16 06:40:20 deraadt Exp $ */
/* $NetBSD: rdate.c,v 1.4 1996/03/16 12:37:45 pk Exp $ */
/*
* midnight January 1st 1900.
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/time.h>
-/* $OpenBSD: rfc868time.c,v 1.9 2013/11/12 22:27:13 deraadt Exp $ */
+/* $OpenBSD: rfc868time.c,v 1.10 2015/01/16 06:40:20 deraadt Exp $ */
/* $NetBSD: rdate.c,v 1.4 1996/03/16 12:37:45 pk Exp $ */
/*
* midnight January 1st 1900.
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
-/* $OpenBSD: relayctl.c,v 1.51 2014/07/09 16:42:05 reyk Exp $ */
+/* $OpenBSD: relayctl.c,v 1.52 2015/01/16 06:40:20 deraadt Exp $ */
/*
* Copyright (c) 2007 - 2013 Reyk Floeter <reyk@openbsd.org>
struct router *rt;
struct netroute *nr;
struct ctl_stats stats[RELAY_MAXPROC];
- char name[MAXHOSTNAMELEN];
+ char name[HOST_NAME_MAX+1];
switch (imsg->hdr.type) {
case IMSG_CTL_RDR:
/*
* Quota report
*/
-#include <sys/param.h>
+#include <sys/param.h> /* dbtob */
#include <sys/stat.h>
#include <ufs/ufs/quota.h>
#include <fstab.h>
-/* $OpenBSD: kroute.c,v 1.25 2014/06/23 03:46:17 guenther Exp $ */
+/* $OpenBSD: kroute.c,v 1.26 2015/01/16 06:40:20 deraadt Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
-/* $OpenBSD: rde.c,v 1.17 2014/07/12 20:16:38 krw Exp $ */
+/* $OpenBSD: rde.c,v 1.18 2015/01/16 06:40:20 deraadt Exp $ */
/*
* Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h> /* for MIN() */
#include <sys/socket.h>
#include <sys/queue.h>
#include <netinet/in.h>
#include "log.h"
#include "rde.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
struct ripd_conf *rdeconf = NULL;
struct imsgev *iev_ripe;
struct imsgev *iev_main;
if ((iface = if_find_index(e->ifindex)) == NULL)
return (-1);
- metric = MIN(INFINITY, e->metric + iface->cost);
+ metric = MINIMUM(INFINITY, e->metric + iface->cost);
if ((rn = rt_find(e->address.s_addr, e->mask.s_addr)) == NULL) {
if (metric >= INFINITY)
-/* $OpenBSD: ripd.c,v 1.23 2014/07/12 20:16:38 krw Exp $ */
+/* $OpenBSD: ripd.c,v 1.24 2015/01/16 06:40:20 deraadt Exp $ */
/*
* Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/wait.h>
-#include <sys/param.h>
#include <sys/sysctl.h>
#include <netinet/in.h>
-/* $OpenBSD: rmt.c,v 1.14 2013/12/03 00:20:03 deraadt Exp $ */
+/* $OpenBSD: rmt.c,v 1.15 2015/01/16 06:40:20 deraadt Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/mtio.h>
-#include <sys/param.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
+#include <limits.h>
int tape = -1;
int maxrecsize = -1;
#define STRSIZE 64
-char device[MAXPATHLEN];
+char device[PATH_MAX];
char count[STRSIZE], mode[STRSIZE], pos[STRSIZE], op[STRSIZE];
char resp[BUFSIZ];
-/* $OpenBSD: route6d.c,v 1.63 2014/10/08 10:57:17 deraadt Exp $ */
+/* $OpenBSD: route6d.c,v 1.64 2015/01/16 06:40:20 deraadt Exp $ */
/* $KAME: route6d.c,v 1.111 2006/10/25 06:38:13 jinmei Exp $ */
/*
#include <poll.h>
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/file.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
-/* $OpenBSD: lockd.c,v 1.12 2009/11/15 09:07:56 chl Exp $ */
+/* $OpenBSD: lockd.c,v 1.13 2015/01/16 06:40:20 deraadt Exp $ */
/*
* Copyright (c) 1995
*
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <rpc/rpc.h>
-/* $OpenBSD: lockd_lock.c,v 1.8 2013/04/23 18:17:22 deraadt Exp $ */
+/* $OpenBSD: lockd_lock.c,v 1.9 2015/01/16 06:40:20 deraadt Exp $ */
/*
* Copyright (c) 2000 Manuel Bouyer.
*
*/
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/mount.h>
+#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <signal.h>
#include <rpc/rpc.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/param.h>
-#include <sys/mount.h>
-#include <sys/wait.h>
#include <rpcsvc/sm_inter.h>
#include <rpcsvc/nlm_prot.h>
#include "lockd_lock.h"
-/* $OpenBSD: procs.c,v 1.14 2011/03/22 10:16:23 okan Exp $ */
+/* $OpenBSD: procs.c,v 1.15 2015/01/16 06:40:20 deraadt Exp $ */
/*
* Copyright (c) 1995
*
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <rpc/rpc.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h>
+#include <limits.h>
#include "lockd.h"
#include "lockd_lock.h"
{
struct sockaddr_in *addr;
struct hostent *host;
- char hostname_buf[MAXHOSTNAMELEN];
+ char hostname_buf[HOST_NAME_MAX+1];
addr = svc_getcaller(req->rq_xprt);
host = gethostbyaddr((char *) &(addr->sin_addr), addr->sin_len, AF_INET);
-/* $OpenBSD: statd.c,v 1.1 2008/06/15 04:43:28 sturm Exp $ */
+/* $OpenBSD: statd.c,v 1.2 2015/01/16 06:40:20 deraadt Exp $ */
/*
* Copyright (c) 1997 Christos Zoulas. All rights reserved.
/* file was generated by running rpcgen /usr/include/rpcsvc/sm_inter.x */
/* The actual program logic is in the file procs.c */
-#include <sys/param.h>
#include <sys/wait.h>
#include <err.h>
{
DBT key, data;
char *ptr;
- char hostname[MAXHOSTNAMELEN + 1];
+ char hostname[HOST_NAME_MAX+1 + 1];
HostInfo h;
strlcpy(hostname, hostnamep, sizeof(hostname));
CLIENT *cli;
char dummy;
stat_chge arg;
- char our_hostname[MAXHOSTNAMELEN + 1];
+ char our_hostname[HOST_NAME_MAX+1 + 1];
gethostname(our_hostname, sizeof(our_hostname));
our_hostname[sizeof(our_hostname) - 1] = '\0';
-/* $OpenBSD: config.c,v 1.42 2014/07/04 22:39:31 guenther Exp $ */
+/* $OpenBSD: config.c,v 1.43 2015/01/16 06:40:20 deraadt Exp $ */
/* $KAME: config.c,v 1.62 2002/05/29 10:13:10 itojun Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/time.h>
-/* $OpenBSD: if.c,v 1.26 2014/06/29 00:58:45 deraadt Exp $ */
+/* $OpenBSD: if.c,v 1.27 2015/01/16 06:40:20 deraadt Exp $ */
/* $KAME: if.c,v 1.17 2001/01/21 15:27:30 itojun Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/queue.h>
-/* $OpenBSD: rrenum.c,v 1.17 2014/06/29 00:58:45 deraadt Exp $ */
+/* $OpenBSD: rrenum.c,v 1.18 2015/01/16 06:40:20 deraadt Exp $ */
/* $KAME: rrenum.c,v 1.11 2002/05/21 14:26:55 itojun Exp $ */
/*
* SUCH DAMAGE.
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
-/* $OpenBSD: rtadvd.c,v 1.52 2015/01/01 20:28:27 florian Exp $ */
+/* $OpenBSD: rtadvd.c,v 1.53 2015/01/16 06:40:20 deraadt Exp $ */
/* $KAME: rtadvd.c,v 1.66 2002/05/29 14:18:36 itojun Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/signal.h>
#include <sys/uio.h>
#include <sys/time.h>
#include <sys/queue.h>
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: extern.h,v 1.3 2002/02/16 21:28:09 millert Exp $
+ * $Id: extern.h,v 1.4 2015/01/16 06:40:20 deraadt Exp $
*/
-#include <sys/types.h>
-#include <sys/param.h>
+#include <sys/param.h> /* MAXCOMLEN */
#include <db.h>
/* structures */
-/* $OpenBSD: monitor.c,v 1.18 2014/06/29 00:58:45 deraadt Exp $ */
+/* $OpenBSD: monitor.c,v 1.19 2015/01/16 06:40:20 deraadt Exp $ */
/*
* Copyright (c) 2005 HÃ¥kan Olsson. All rights reserved.
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
+#include <limits.h>
#include <imsg.h>
#include "types.h" /* iked imsg types */
{
struct passwd *pw = getpwnam(SASYNCD_USER);
extern char *__progname;
- char root[MAXPATHLEN];
+ char root[PATH_MAX];
int p[2];
if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, p) != 0) {
-/* $OpenBSD: pfkey.c,v 1.22 2014/10/26 14:47:37 chl Exp $ */
+/* $OpenBSD: pfkey.c,v 1.23 2015/01/16 06:40:20 deraadt Exp $ */
/*
* Copyright (c) 2005 HÃ¥kan Olsson. All rights reserved.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
-/* $OpenBSD: sensorsd.c,v 1.53 2014/06/29 00:58:45 deraadt Exp $ */
+/* $OpenBSD: sensorsd.c,v 1.54 2015/01/16 06:40:20 deraadt Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/sysctl.h>
#include <sys/queue.h>
#include <sys/sensors.h>
#include <syslog.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#define RFBUFSIZ 28 /* buffer size for print_sensor */
#define RFBUFCNT 4 /* ring buffers */
-/* $OpenBSD: slowcgi.c,v 1.41 2014/12/08 12:12:46 blambert Exp $ */
+/* $OpenBSD: slowcgi.c,v 1.42 2015/01/16 06:40:20 deraadt Exp $ */
/*
* Copyright (c) 2013 David Gwynne <dlg@openbsd.org>
* Copyright (c) 2013 Florian Obser <florian@openbsd.org>
#include <errno.h>
#include <event.h>
#include <netdb.h>
+#include <limits.h>
#include <pwd.h>
#include <signal.h>
#include <stdio.h>
struct fcgi_response_head response_head;
struct fcgi_stdin_head stdin_head;
uint16_t id;
- char script_name[MAXPATHLEN];
+ char script_name[PATH_MAX];
struct env_head env;
int env_count;
pid_t script_pid;
n -= name_len;
env_entry->val[name_len] = '\0';
- if (val_len < MAXPATHLEN && strcmp(env_entry->val,
+ if (val_len < PATH_MAX && strcmp(env_entry->val,
"SCRIPT_NAME") == 0 && c->script_name[0] == '\0') {
bcopy(buf, c->script_name, val_len);
c->script_name[val_len] = '\0';
- } else if (val_len < MAXPATHLEN && strcmp(env_entry->val,
+ } else if (val_len < PATH_MAX && strcmp(env_entry->val,
"SCRIPT_FILENAME") == 0) {
bcopy(buf, c->script_name, val_len);
c->script_name[val_len] = '\0';
-/* $OpenBSD: ber.c,v 1.4 2013/12/26 17:25:32 eric Exp $ */
+/* $OpenBSD: ber.c,v 1.5 2015/01/16 06:40:20 deraadt Exp $ */
/*
* Copyright (c) 2007 Reyk Floeter <reyk@vantronix.net>
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <errno.h>
#include <limits.h>
#include "ber.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
#define BER_TYPE_CONSTRUCTED 0x20 /* otherwise primitive */
#define BER_TYPE_SINGLE_MAX 30
return -1;
sz = b->br_rend - b->br_rptr;
- len = MIN(nbytes, sz);
+ len = MINIMUM(nbytes, sz);
if (len == 0) {
errno = ECANCELED;
return (-1); /* end of buffer and parser wants more data */
-/* $OpenBSD: ca.c,v 1.12 2014/12/24 08:43:58 eric Exp $ */
+/* $OpenBSD: ca.c,v 1.13 2015/01/16 06:40:20 deraadt Exp $ */
/*
* Copyright (c) 2014 Reyk Floeter <reyk@openbsd.org>
#include <signal.h>
#include <string.h>
+#include <limits.h>
#include <stdlib.h>
#include <unistd.h>
#include <imsg.h>
-/* $OpenBSD: config.c,v 1.31 2014/05/01 15:50:20 reyk Exp $ */
+/* $OpenBSD: config.c,v 1.32 2015/01/16 06:40:20 deraadt Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
#include <imsg.h>
#include <stdio.h>
#include <stdlib.h>
+#include <limits.h>
#include <string.h>
#include <unistd.h>
-/* $OpenBSD: envelope.c,v 1.29 2014/04/19 12:30:54 gilles Exp $ */
+/* $OpenBSD: envelope.c,v 1.30 2015/01/16 06:40:20 deraadt Exp $ */
/*
* Copyright (c) 2013 Eric Faurot <eric@openbsd.org>
#include <inttypes.h>
#include <libgen.h>
#include <pwd.h>
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-/* $OpenBSD: lka.c,v 1.173 2014/09/03 07:42:47 giovanni Exp $ */
+/* $OpenBSD: lka.c,v 1.174 2015/01/16 06:40:20 deraadt Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
#include <openssl/ssl.h>
#include <pwd.h>
#include <resolv.h>
+#include <limits.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
-/* $OpenBSD: makemap.c,v 1.50 2014/10/25 18:48:30 gilles Exp $ */
+/* $OpenBSD: makemap.c,v 1.51 2015/01/16 06:40:20 deraadt Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <util.h>
#include "smtpd.h"
-/* $OpenBSD: mproc.c,v 1.10 2014/07/08 13:49:09 eric Exp $ */
+/* $OpenBSD: mproc.c,v 1.11 2015/01/16 06:40:20 deraadt Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@faurot.net>
#include <imsg.h>
#include <stdio.h>
#include <stdlib.h>
+#include <limits.h>
#include <string.h>
#include <unistd.h>
-/* $OpenBSD: mta.c,v 1.189 2014/07/08 13:02:42 eric Exp $ */
+/* $OpenBSD: mta.c,v 1.190 2015/01/16 06:40:20 deraadt Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
#include <imsg.h>
#include <inttypes.h>
#include <netdb.h>
+#include <limits.h>
#include <pwd.h>
#include <signal.h>
#include <stdio.h>
-/* $OpenBSD: mta_session.c,v 1.69 2014/12/24 13:51:31 eric Exp $ */
+/* $OpenBSD: mta_session.c,v 1.70 2015/01/16 06:40:20 deraadt Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
#include <openssl/ssl.h>
#include <pwd.h>
#include <resolv.h>
+#include <limits.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
-/* $OpenBSD: parse.y,v 1.149 2014/11/20 05:51:21 jsg Exp $ */
+/* $OpenBSD: parse.y,v 1.150 2015/01/16 06:40:20 deraadt Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
#include <imsg.h>
#include <inttypes.h>
#include <netdb.h>
+#include <limits.h>
#include <paths.h>
#include <pwd.h>
#include <stdio.h>
}
} filter_args;
| PKI STRING {
- char buf[MAXHOSTNAMELEN];
+ char buf[HOST_NAME_MAX+1];
xlowercase(buf, $2, sizeof(buf));
free($2);
pki = dict_get(conf->sc_pki_dict, buf);
-/* $OpenBSD: queue_backend.c,v 1.53 2014/12/08 08:19:36 gilles Exp $ */
+/* $OpenBSD: queue_backend.c,v 1.54 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@poolp.org>
#include <event.h>
#include <fcntl.h>
#include <imsg.h>
+#include <limits.h>
#include <inttypes.h>
#include <libgen.h>
#include <pwd.h>
int
queue_message_delete(uint32_t msgid)
{
- char msgpath[MAXPATHLEN];
+ char msgpath[PATH_MAX];
int r;
profile_enter("queue_message_delete");
queue_message_commit(uint32_t msgid)
{
int r;
- char msgpath[MAXPATHLEN];
- char tmppath[MAXPATHLEN];
+ char msgpath[PATH_MAX];
+ char tmppath[PATH_MAX];
FILE *ifp = NULL;
FILE *ofp = NULL;
-/* $OpenBSD: queue_fs.c,v 1.6 2014/07/08 15:45:32 eric Exp $ */
+/* $OpenBSD: queue_fs.c,v 1.7 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@poolp.org>
*/
#include <sys/types.h>
+#include <sys/mount.h>
#include <sys/queue.h>
#include <sys/tree.h>
#include <sys/socket.h>
#include <sys/stat.h>
-#include <sys/param.h>
-#include <sys/mount.h>
#include <ctype.h>
#include <err.h>
-/* $OpenBSD: queue_proc.c,v 1.3 2014/07/08 15:45:32 eric Exp $ */
+/* $OpenBSD: queue_proc.c,v 1.4 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 2013 Eric Faurot <eric@openbsd.org>
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/tree.h>
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/stat.h>
-/* $OpenBSD: scheduler_proc.c,v 1.5 2014/07/10 14:45:02 eric Exp $ */
+/* $OpenBSD: scheduler_proc.c,v 1.6 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 2013 Eric Faurot <eric@openbsd.org>
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/tree.h>
-#include <sys/param.h>
#include <sys/socket.h>
#include <ctype.h>
-/* $OpenBSD: smtp.c,v 1.141 2014/11/05 19:38:09 gilles Exp $ */
+/* $OpenBSD: smtp.c,v 1.142 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
#include <netdb.h>
#include <pwd.h>
#include <signal.h>
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-/* $OpenBSD: smtp_session.c,v 1.225 2015/01/14 08:50:32 gilles Exp $ */
+/* $OpenBSD: smtp_session.c,v 1.226 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
#include <errno.h>
#include <event.h>
#include <imsg.h>
+#include <limits.h>
#include <inttypes.h>
#include <openssl/ssl.h>
#include <resolv.h>
-/* $OpenBSD: smtpd.c,v 1.236 2015/01/15 09:05:37 gilles Exp $ */
+/* $OpenBSD: smtpd.c,v 1.237 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
#include <pwd.h>
#include <signal.h>
#include <stdio.h>
+#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
-/* $OpenBSD: ssl_smtpd.c,v 1.7 2014/04/29 19:13:14 reyk Exp $ */
+/* $OpenBSD: ssl_smtpd.c,v 1.8 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
#include <ctype.h>
#include <event.h>
#include <fcntl.h>
+#include <limits.h>
#include <imsg.h>
#include <pwd.h>
#include <stdio.h>
-/* $OpenBSD: table_passwd.c,v 1.8 2014/09/29 08:41:55 gilles Exp $ */
+/* $OpenBSD: table_passwd.c,v 1.9 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 2013 Gilles Chehade <gilles@poolp.org>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
+#include <limits.h>
#include <string.h>
#include <unistd.h>
-/* $OpenBSD: table_proc.c,v 1.3 2014/07/08 13:49:09 eric Exp $ */
+/* $OpenBSD: table_proc.c,v 1.4 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 2013 Eric Faurot <eric@openbsd.org>
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/tree.h>
-#include <sys/param.h>
#include <sys/socket.h>
#include <ctype.h>
-/* $OpenBSD: table_sqlite.c,v 1.14 2014/07/08 13:49:09 eric Exp $ */
+/* $OpenBSD: table_sqlite.c,v 1.15 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 2013 Eric Faurot <eric@openbsd.org>
#include <fcntl.h>
#include <sqlite3.h>
#include <stdio.h>
+#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
-/* $OpenBSD: to.c,v 1.17 2014/04/19 14:27:29 gilles Exp $ */
+/* $OpenBSD: to.c,v 1.18 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 2009 Jacek Masiulaniec <jacekm@dobremiasto.net>
#include <fcntl.h>
#include <fts.h>
#include <imsg.h>
+#include <limits.h>
#include <inttypes.h>
#include <libgen.h>
#include <netdb.h>
-/* $OpenBSD: util.c,v 1.110 2014/05/25 10:55:36 espie Exp $ */
+/* $OpenBSD: util.c,v 1.111 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 2000,2001 Markus Friedl. All rights reserved.
#include <libgen.h>
#include <netdb.h>
#include <pwd.h>
+#include <limits.h>
#include <resolv.h>
#include <stdarg.h>
#include <stdio.h>
-/* $OpenBSD: snmpclient.c,v 1.12 2014/11/18 20:54:29 krw Exp $ */
+/* $OpenBSD: snmpclient.c,v 1.13 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 2013 Reyk Floeter <reyk@openbsd.org>
*/
#include <sys/queue.h>
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
-/* $OpenBSD: privsep.c,v 1.49 2014/12/31 13:55:57 bluhm Exp $ */
+/* $OpenBSD: privsep.c,v 1.50 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 2003 Anil Madhavapeddy <anil@recoil.org>
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+
#include <sys/ioctl.h>
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/uio.h>
#include <sys/types.h>
#include <unistd.h>
#include <util.h>
#include <utmp.h>
+#include <limits.h>
#include "syslogd.h"
/*
static int priv_fd = -1;
static volatile pid_t child_pid = -1;
-static char config_file[MAXPATHLEN];
+static char config_file[PATH_MAX];
static struct stat cf_info;
static int allow_getnameinfo = 0;
static volatile sig_atomic_t cur_state = STATE_INIT;
/* Queue for the allowed logfiles */
struct logname {
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
TAILQ_ENTRY(logname) next;
};
static TAILQ_HEAD(, logname) lognames;
{
int i, fd, socks[2], cmd, addr_len, result, restart;
size_t path_len, protoname_len, hostname_len, servname_len;
- char path[MAXPATHLEN], protoname[5], hostname[MAXHOSTNAMELEN];
+ char path[PATH_MAX], protoname[5], hostname[HOST_NAME_MAX+1];
char servname[NI_MAXSERV];
struct sockaddr_storage addr;
struct stat cf_stat;
lg = malloc(sizeof(struct logname));
if (!lg)
err(1, "check_log_name() malloc");
- strlcpy(lg->path, lognam, MAXPATHLEN);
+ strlcpy(lg->path, lognam, PATH_MAX);
TAILQ_INSERT_TAIL(&lognames, lg, next);
break;
case STATE_RUNNING:
int
priv_open_tty(const char *tty)
{
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
int cmd, fd;
size_t path_len;
int
priv_open_log(const char *lognam)
{
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
int cmd, fd;
size_t path_len;
priv_getaddrinfo(char *proto, char *host, char *serv, struct sockaddr *addr,
size_t addr_len)
{
- char protocpy[5], hostcpy[MAXHOSTNAMELEN], servcpy[NI_MAXSERV];
+ char protocpy[5], hostcpy[HOST_NAME_MAX+1], servcpy[NI_MAXSERV];
int cmd, ret_len;
size_t protoname_len, hostname_len, servname_len;
-/* $OpenBSD: privsep_fdpass.c,v 1.8 2012/04/04 17:24:50 deraadt Exp $ */
+/* $OpenBSD: privsep_fdpass.c,v 1.9 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright 2001 Niels Provos <provos@citi.umich.edu>
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
+
#include <sys/uio.h>
#include <sys/types.h>
#include <sys/socket.h>
-/* $OpenBSD: ringbuf.c,v 1.7 2005/09/21 23:25:32 djm Exp $ */
+/* $OpenBSD: ringbuf.c,v 1.8 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 2004 Damien Miller
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "syslogd.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
/* Initialise a ring buffer */
struct ringbuf *
ringbuf_init(size_t len)
if (buf == NULL || rb == NULL || len == 0)
return (-1);
- copy_len = MIN(len - 1, ringbuf_used(rb));
+ copy_len = MINIMUM(len - 1, ringbuf_used(rb));
if (copy_len == 0)
return (copy_len);
else {
/* If the buffer is wrapped, copy each hunk separately */
n = rb->len - rb->start;
- memcpy(buf, rb->buf + rb->start, MIN(n, copy_len));
+ memcpy(buf, rb->buf + rb->start, MINIMUM(n, copy_len));
if (copy_len > n)
- memcpy(buf + n, rb->buf, MIN(rb->end, copy_len - n));
+ memcpy(buf + n, rb->buf, MINIMUM(rb->end, copy_len - n));
}
buf[copy_len] = '\0';
-/* $OpenBSD: syslogd.c,v 1.141 2015/01/15 11:49:59 bluhm Exp $ */
+/* $OpenBSD: syslogd.c,v 1.142 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1983, 1988, 1993, 1994
#define TIMERINTVL 30 /* interval for checking flush, mark */
#define TTYMSGTIME 1 /* timeout passed to ttymsg */
-#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <utmp.h>
#include <vis.h>
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
#define SYSLOG_NAMES
#include <sys/syslog.h>
union {
char f_uname[MAXUNAMES][UT_NAMESIZE+1];
struct {
- char f_loghost[1+4+3+1+MAXHOSTNAMELEN+1+NI_MAXSERV];
+ char f_loghost[1+4+3+1+HOST_NAME_MAX+1+1+NI_MAXSERV];
/* @proto46://[hostname]:servname\0 */
struct sockaddr_storage f_addr;
struct bufferevent *f_bufev;
int f_reconnectwait;
} f_forw; /* forwarding address */
- char f_fname[MAXPATHLEN];
+ char f_fname[PATH_MAX];
struct {
char f_mname[MAX_MEMBUF_NAME];
struct ringbuf *f_rb;
} f_un;
char f_prevline[MAXSVLINE]; /* last message logged */
char f_lasttime[16]; /* time of last occurrence */
- char f_prevhost[MAXHOSTNAMELEN]; /* host from which recd. */
+ char f_prevhost[HOST_NAME_MAX+1]; /* host from which recd. */
int f_prevpri; /* pri of f_prevline */
int f_prevlen; /* length of f_prevline */
int f_prevcount; /* repetition cnt of prevline */
char *path_unix[MAXUNIX] = { _PATH_LOG }; /* Paths to Unix domain sockets */
int Debug; /* debug flag */
int Startup = 1; /* startup flag */
-char LocalHostName[MAXHOSTNAMELEN]; /* our hostname */
+char LocalHostName[HOST_NAME_MAX+1]; /* our hostname */
char *LocalDomain; /* our local domain name */
int Initialized = 0; /* set when we have initialized ourselves */
salen = sizeof(sa);
n = recvfrom(fd, linebuf, MAXLINE, 0, (struct sockaddr *)&sa, &salen);
if (n > 0) {
- char resolve[MAXHOSTNAMELEN];
+ char resolve[HOST_NAME_MAX+1];
linebuf[n] = '\0';
cvthname((struct sockaddr *)&sa, resolve, sizeof(resolve));
logerror(ebuf);
break;
}
- if (strlen(host) >= MAXHOSTNAMELEN) {
+ if (strlen(host) >= HOST_NAME_MAX+1) {
snprintf(ebuf, sizeof(ebuf), "host too long \"%s\"",
f->f_un.f_forw.f_loghost);
logerror(ebuf);
}
/* Set buffer length */
- rb_len = MAX(rb_len, MIN_MEMBUF);
+ rb_len = MAXIMUM(rb_len, MIN_MEMBUF);
f->f_un.f_mb.f_len = rb_len;
f->f_un.f_mb.f_overflow = 0;
f->f_un.f_mb.f_attached = 0;
-/* $OpenBSD: ttymsg.c,v 1.5 2014/08/25 18:05:30 bluhm Exp $ */
+/* $OpenBSD: ttymsg.c,v 1.6 2015/01/16 06:40:21 deraadt Exp $ */
/* $NetBSD: ttymsg.c,v 1.3 1994/11/17 07:17:55 jtc Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* nitems */
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/uio.h>
-/* $OpenBSD: tcpdrop.c,v 1.16 2015/01/13 03:43:18 lteo Exp $ */
+/* $OpenBSD: tcpdrop.c,v 1.17 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 2004 Markus Friedl <markus@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/queue.h>
-/* $OpenBSD: addrtoname.c,v 1.32 2014/10/08 04:58:50 deraadt Exp $ */
+/* $OpenBSD: addrtoname.c,v 1.33 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
* and address to string conversion routines
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
+#include <limits.h>
#include "interface.h"
#include "addrtoname.h"
char *
getname(const u_char *ap)
{
- char host[MAXHOSTNAMELEN];
+ char host[HOST_NAME_MAX+1];
u_int32_t addr;
struct hnamemem *p;
char *
getname6(const u_char *ap)
{
- char host[MAXHOSTNAMELEN];
+ char host[HOST_NAME_MAX+1];
struct in6_addr addr;
struct h6namemem *p;
register char *cp;
return (tp->e_name);
#ifdef HAVE_ETHER_NTOHOST
if (!nflag) {
- char buf[MAXHOSTNAMELEN + 1];
+ char buf[HOST_NAME_MAX+1 + 1];
if (priv_ether_ntohost(buf, sizeof(buf),
(struct ether_addr *)ep) > 0) {
tp->e_name = savestr(buf);
register struct etherlist *el;
register struct enamemem *tp;
#ifdef HAVE_ETHER_NTOHOST
- char name[MAXHOSTNAMELEN + 1];
+ char name[HOST_NAME_MAX+1 + 1];
#else
register struct pcap_etherent *ep;
register FILE *fp;
-/* $OpenBSD: print-802_11.c,v 1.15 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-802_11.c,v 1.16 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 2005 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/file.h>
-/* $OpenBSD: print-arp.c,v 1.12 2009/10/27 23:59:55 deraadt Exp $ */
+/* $OpenBSD: print-arp.c,v 1.13 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
-/* $OpenBSD: print-atalk.c,v 1.27 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-atalk.c,v 1.28 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
* Format and print AppleTalk packets.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include "interface.h"
#include "addrtoname.h"
init_atalk(void)
{
struct hnamemem *tp;
- char nambuf[MAXHOSTNAMELEN + 20];
+ char nambuf[HOST_NAME_MAX+1 + 20];
char line[BUFSIZ];
int i1, i2, i3;
{
register struct hnamemem *tp, *tp2;
register int i = (atnet << 8) | athost;
- char nambuf[MAXHOSTNAMELEN + 20];
+ char nambuf[HOST_NAME_MAX+1 + 20];
static int first = 1;
if (first) {
-/* $OpenBSD: print-atm.c,v 1.11 2014/11/20 04:11:33 jsg Exp $ */
+/* $OpenBSD: print-atm.c,v 1.12 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1994, 1995, 1996, 1997
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
-/* $OpenBSD: print-bgp.c,v 1.16 2014/01/12 11:26:48 deraadt Exp $ */
+/* $OpenBSD: print-bgp.c,v 1.17 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (C) 1999 WIDE Project.
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
#include <string.h>
#include <netdb.h>
+#include <limits.h>
#include "interface.h"
#include "addrtoname.h"
int advance;
int tlen, asn_bytes;
const u_char *p;
- char buf[MAXHOSTNAMELEN + 100];
+ char buf[HOST_NAME_MAX+1 + 100];
p = dat;
tlen = len;
#ifdef INET6
printf(" (Withdrawn routes: %d bytes)", len);
#else
- char buf[MAXHOSTNAMELEN + 100];
+ char buf[HOST_NAME_MAX+1 + 100];
int wpfx;
TCHECK2(p[2], len);
if (dat + length > p) {
printf("(NLRI:"); /* ) */
while (dat + length > p) {
- char buf[MAXHOSTNAMELEN + 100];
+ char buf[HOST_NAME_MAX+1 + 100];
i = decode_prefix4(p, buf, sizeof(buf));
if (i == -1) {
printf(" (illegal prefix length)");
-/* $OpenBSD: print-bootp.c,v 1.18 2013/10/27 18:49:25 guenther Exp $ */
+/* $OpenBSD: print-bootp.c,v 1.19 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
*
* Format and print bootp packets.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
-/* $OpenBSD: print-cdp.c,v 1.4 2009/10/27 23:59:55 deraadt Exp $ */
+/* $OpenBSD: print-cdp.c,v 1.5 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1992, 1993, 1994, 1995, 1996, 1997
* http://www.cisco.com/univercd/cc/td/doc/product/lan/trsrb/frames.htm
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <netinet/in.h>
-/* $OpenBSD: print-decnet.c,v 1.12 2009/10/27 23:59:55 deraadt Exp $ */
+/* $OpenBSD: print-decnet.c,v 1.13 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1992, 1993, 1994, 1995, 1996, 1997
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
-/* $OpenBSD: print-dhcp6.c,v 1.7 2009/10/27 23:59:55 deraadt Exp $ */
+/* $OpenBSD: print-dhcp6.c,v 1.8 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (C) 1998 and 1999 WIDE Project.
#ifdef INET6
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
-/* $OpenBSD: print-domain.c,v 1.20 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-domain.c,v 1.21 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
-/* $OpenBSD: print-dvmrp.c,v 1.7 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-dvmrp.c,v 1.8 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1995, 1996
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
-/* $OpenBSD: print-enc.c,v 1.12 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-enc.c,v 1.13 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* MSIZE */
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/file.h>
-/* $OpenBSD: print-ether.c,v 1.28 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-ether.c,v 1.29 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
-/* $OpenBSD: print-etherip.c,v 1.7 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-etherip.c,v 1.8 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 2001 Jason L. Wright (jason@thought.net)
* Format and print etherip packets
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
-/* $OpenBSD: print-fddi.c,v 1.15 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-fddi.c,v 1.16 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997
*/
#ifdef HAVE_FDDI
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/file.h>
-/* $OpenBSD: print-frag6.c,v 1.6 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-frag6.c,v 1.7 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1993, 1994
#ifdef INET6
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
-/* $OpenBSD: print-gre.c,v 1.8 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-gre.c,v 1.9 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 2002 Jason L. Wright (jason@thought.net)
* RFC1701 (GRE), RFC1702 (GRE IPv4), and RFC2637 (Enhanced GRE)
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/uio.h>
#include <sys/socket.h>
-/* $OpenBSD: print-gtp.c,v 1.6 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-gtp.c,v 1.7 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 2009, 2010 Joel Sing <jsing@openbsd.org>
*
* 3GPP TS 32.295 - Charging Data Record (CDR) transfer (GTPv1')
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/types.h>
-/* $OpenBSD: print-iapp.c,v 1.4 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-iapp.c,v 1.5 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 2005 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/file.h>
-/* $OpenBSD: print-icmp.c,v 1.24 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-icmp.c,v 1.25 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1993, 1994, 1995, 1996
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <stdio.h>
#include <string.h>
+#include <limits.h>
#include "interface.h"
#include "addrtoname.h"
const struct ip *oip;
const struct udphdr *ouh;
u_int hlen, dport, mtu;
- char buf[MAXHOSTNAMELEN+256];
- char buf2[MAXHOSTNAMELEN+256];
+ char buf[HOST_NAME_MAX+1+256];
+ char buf2[HOST_NAME_MAX+1+256];
dp = (struct icmp *)bp;
ip = (struct ip *)bp2;
-/* $OpenBSD: print-icmp6.c,v 1.14 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-icmp6.c,v 1.15 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1993, 1994
#include <ctype.h>
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
-/* $OpenBSD: print-igrp.c,v 1.6 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-igrp.c,v 1.7 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1996, 1997
* Initial contribution from Francis Dupont (francis.dupont@inria.fr)
*/
-#include <sys/param.h>
#include <sys/types.h> /* concession to AIX */
#include <sys/socket.h>
-/* $OpenBSD: print-ike.c,v 1.36 2012/01/28 13:47:55 sthen Exp $ */
+/* $OpenBSD: print-ike.c,v 1.37 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999
* in co-operation with SSH Communications Security, Espoo, Finland
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
-/* $OpenBSD: print-ip.c,v 1.42 2014/12/09 17:03:19 mikeb Exp $ */
+/* $OpenBSD: print-ip.c,v 1.43 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
-/* $OpenBSD: print-ip6.c,v 1.20 2014/12/09 17:03:19 mikeb Exp $ */
+/* $OpenBSD: print-ip6.c,v 1.21 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994
#ifdef INET6
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
-/* $OpenBSD: print-ip6opts.c,v 1.3 2006/12/09 01:12:28 itojun Exp $ */
+/* $OpenBSD: print-ip6opts.c,v 1.4 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (C) 1998 WIDE Project.
*/
#ifdef INET6
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
-/* $OpenBSD: print-ipsec.c,v 1.19 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-ipsec.c,v 1.20 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999
* in co-operation with SSH Communications Security, Espoo, Finland
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
-/* $OpenBSD: print-ipx.c,v 1.13 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-ipx.c,v 1.14 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1994, 1995, 1996
* Contributed by Brad Parker (brad@fcr.com).
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
-/* $OpenBSD: print-krb.c,v 1.9 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-krb.c,v 1.10 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1995, 1996, 1997
* Initial contribution from John Hawkinson (jhawk@mit.edu).
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
-/* $OpenBSD: print-l2tp.c,v 1.7 2011/09/18 14:04:36 naddy Exp $ */
+/* $OpenBSD: print-l2tp.c,v 1.8 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <stdio.h>
#include <strings.h>
-/* $OpenBSD: print-llc.c,v 1.18 2009/10/27 23:59:55 deraadt Exp $ */
+/* $OpenBSD: print-llc.c,v 1.19 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1992, 1993, 1994, 1995, 1996, 1997
* with an awful lot of hacking by Jeffrey Mogul, DECWRL
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <netinet/in.h>
-/* $OpenBSD: print-lldp.c,v 1.7 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-lldp.c,v 1.8 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 2006 Reyk Floeter <reyk@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include "config.h"
#endif
-#include <sys/param.h>
#include <sys/time.h>
#include <netinet/in.h>
-/* $OpenBSD: print-mobile.c,v 1.4 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-mobile.c,v 1.5 2015/01/16 06:40:21 deraadt Exp $ */
/* $NetBSD: print-mobile.c,v 1.3 1999/07/26 06:11:57 itojun Exp $ */
/*
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/uio.h>
#include <sys/socket.h>
-/* $OpenBSD: print-netbios.c,v 1.9 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-netbios.c,v 1.10 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1994, 1995, 1996
* Contributed by Brad Parker (brad@fcr.com).
*/
-#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
-/* $OpenBSD: print-nfs.c,v 1.18 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-nfs.c,v 1.19 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
-/* $OpenBSD: print-ntp.c,v 1.15 2009/10/27 23:59:55 deraadt Exp $ */
+/* $OpenBSD: print-ntp.c,v 1.16 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
* loosely based on print-bootp.c
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
-/* $OpenBSD: print-null.c,v 1.20 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-null.c,v 1.21 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1991, 1993, 1994, 1995, 1996, 1997
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/file.h>
-/* $OpenBSD: print-ospf.c,v 1.18 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-ospf.c,v 1.19 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1992, 1993, 1994, 1995, 1996, 1997
* OSPF support contributed by Jeffrey Honig (jch@mitchell.cit.cornell.edu)
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
-/* $OpenBSD: print-ospf6.c,v 1.7 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-ospf6.c,v 1.8 2015/01/16 06:40:21 deraadt Exp $ */
/*
#ifdef INET6
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
-/* $OpenBSD: print-pflog.c,v 1.25 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-pflog.c,v 1.26 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#include <sys/types.h>
-#include <sys/param.h>
+#include <sys/param.h> /* MSIZE MAXCOMLEN */
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/file.h>
-/* $OpenBSD: print-pfsync.c,v 1.39 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-pfsync.c,v 1.40 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/file.h>
#include <sys/ioctl.h>
-#include <sys/mbuf.h>
#ifdef __STDC__
struct rtentry;
-/* $OpenBSD: print-pim.c,v 1.6 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-pim.c,v 1.7 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1995, 1996
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
-/* $OpenBSD: print-ppp.c,v 1.27 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-ppp.c,v 1.28 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
*/
#ifdef PPP
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/file.h>
-/* $OpenBSD: print-raw.c,v 1.7 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-raw.c,v 1.8 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1996
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/file.h>
-/* $OpenBSD: print-rip.c,v 1.13 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-rip.c,v 1.14 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1989, 1990, 1991, 1993, 1994, 1996
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
-/* $OpenBSD: print-ripng.c,v 1.3 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-ripng.c,v 1.4 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1989, 1990, 1991, 1993, 1994
#ifdef INET6
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
-/* $OpenBSD: print-rt6.c,v 1.4 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-rt6.c,v 1.5 2015/01/16 06:40:21 deraadt Exp $ */
/*
#ifdef INET6
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
-/* $OpenBSD: print-skip.c,v 1.4 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-skip.c,v 1.5 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1995 Sun Microsystems, Inc.
* UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/types.h>
-/* $OpenBSD: print-sl.c,v 1.17 2014/11/20 04:01:01 jsg Exp $ */
+/* $OpenBSD: print-sl.c,v 1.18 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1989, 1990, 1991, 1993, 1994, 1995, 1996, 1997
*/
#ifdef HAVE_NET_SLIP_H
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/file.h>
#include <sys/ioctl.h>
-#include <sys/mbuf.h>
#include <sys/socket.h>
struct rtentry;
#include <netdb.h>
#include <pcap.h>
#include <stdio.h>
+#include <limits.h>
#include "interface.h"
#include "addrtoname.h"
-/* $OpenBSD: print-slow.c,v 1.2 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-slow.c,v 1.3 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1998-2005 The TCPDUMP project
* Original code by Hannes Gredler (hannes@juniper.net)
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/file.h>
-/* $OpenBSD: print-snmp.c,v 1.17 2009/11/12 00:02:16 deraadt Exp $ */
+/* $OpenBSD: print-snmp.c,v 1.18 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
# @(#)snmp.awk.x 1.1 (LANL) 1/15/90
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <ctype.h>
-/* $OpenBSD: print-stp.c,v 1.8 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-stp.c,v 1.9 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 2000 Jason L. Wright (jason@thought.net)
* Pretty print 802.1D Bridge Protocol Data Units
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/file.h>
-/* $OpenBSD: print-sunrpc.c,v 1.18 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-sunrpc.c,v 1.19 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1992, 1993, 1994, 1995, 1996
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
-/* $OpenBSD: print-tcp.c,v 1.31 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-tcp.c,v 1.32 2015/01/16 06:40:21 deraadt Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
-/* $OpenBSD: print-tftp.c,v 1.10 2009/10/27 23:59:57 deraadt Exp $ */
+/* $OpenBSD: print-tftp.c,v 1.11 2015/01/16 06:40:22 deraadt Exp $ */
/*
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
* Format and print trivial file transfer protocol packets.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <netinet/in.h>
-/* $OpenBSD: print-timed.c,v 1.5 2009/10/27 23:59:57 deraadt Exp $ */
+/* $OpenBSD: print-timed.c,v 1.6 2015/01/16 06:40:22 deraadt Exp $ */
/*
* Copyright (c) 2000 Ben Smithurst <ben@scientia.demon.co.uk>
#include "config.h"
#endif
-#include <sys/param.h>
#include <sys/time.h>
#include <netinet/in.h>
-/* $OpenBSD: print-udp.c,v 1.37 2014/08/14 12:44:44 mpi Exp $ */
+/* $OpenBSD: print-udp.c,v 1.38 2015/01/16 06:40:22 deraadt Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
-/* $OpenBSD: privsep.c,v 1.30 2011/09/22 09:12:30 stsp Exp $ */
+/* $OpenBSD: privsep.c,v 1.31 2015/01/16 06:40:22 deraadt Exp $ */
/*
* Copyright (c) 2003 Can Erkin Acar
static void
impl_gethostbyaddr(int fd)
{
- char hostname[MAXHOSTNAMELEN];
+ char hostname[HOST_NAME_MAX+1];
size_t hostname_len;
int addr_af;
struct hostent *hp;
impl_ether_ntohost(int fd)
{
struct ether_addr ether;
- char hostname[MAXHOSTNAMELEN];
+ char hostname[HOST_NAME_MAX+1];
logmsg(LOG_DEBUG, "[priv]: msg PRIV_ETHER_NTOHOST received");
-/* $OpenBSD: smbutil.c,v 1.8 2013/04/16 18:10:24 deraadt Exp $ */
+/* $OpenBSD: smbutil.c,v 1.9 2015/01/16 06:40:22 deraadt Exp $ */
/*
Copyright (C) Andrew Tridgell 1995-1999
#include "config.h"
#endif
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
-/* $OpenBSD: tftp-proxy.c,v 1.10 2013/12/23 13:08:25 florian Exp $
+/* $OpenBSD: tftp-proxy.c,v 1.11 2015/01/16 06:40:22 deraadt Exp $
*
* Copyright (c) 2005 DLS Internet Services
* Copyright (c) 2004, 2005 Camiel Dobbelaar, <cd@sentia.nl>
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/ioctl.h>
-#include <sys/param.h>
#include <sys/types.h>
+#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/uio.h>
-/* $OpenBSD: tftpd.c,v 1.25 2014/12/17 22:23:33 tedu Exp $ */
+/* $OpenBSD: tftpd.c,v 1.26 2015/01/16 06:40:22 deraadt Exp $ */
/*
* Copyright (c) 2012 David Gwynne <dlg@uq.edu.au>
*/
#include <sys/ioctl.h>
-#include <sys/param.h>
-#include <sys/types.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <stdarg.h>
#include <syslog.h>
#include <unistd.h>
+#include <limits.h>
#include <vis.h>
#define TIMEOUT 5 /* packet rexmt timeout */
char *filename;
size_t len;
- switch (evbuffer_read(rwmap->rdbuf, fd, MAXPATHLEN)) {
+ switch (evbuffer_read(rwmap->rdbuf, fd, PATH_MAX)) {
case -1:
switch (errno) {
case EINTR:
int i, first = 1, ecode, to;
struct formats *pf;
char *mode = NULL;
- char filename[MAXPATHLEN];
+ char filename[PATH_MAX];
const char *errstr;
if (size < 5) {
}
if (verbose) {
- char nicebuf[MAXPATHLEN];
+ char nicebuf[PATH_MAX];
- (void)strnvis(nicebuf, filename, MAXPATHLEN,
+ (void)strnvis(nicebuf, filename, PATH_MAX,
VIS_SAFE|VIS_OCTAL);
linfo("%s: %s request for '%s'", getip(&client->ss),
-/* $OpenBSD: tokenadm.c,v 1.9 2007/03/15 22:31:14 jmc Exp $ */
+/* $OpenBSD: tokenadm.c,v 1.10 2015/01/16 06:40:22 deraadt Exp $ */
/*-
* Copyright (c) 1995 Migration Associates Corp. All Rights Reserved
* BSDI $From: tokenadm.c,v 1.2 1996/10/17 00:54:28 prb Exp $
*/
-#include <sys/param.h>
+#include <sys/signal.h>
#include <sys/resource.h>
#include <sys/time.h>
#include <syslog.h>
#include <stdlib.h>
#include <unistd.h>
+#include <limits.h>
#include <string.h>
#include "token.h"
-/* $OpenBSD: tokeninit.c,v 1.7 2008/07/09 19:58:28 sobrado Exp $ */
+/* $OpenBSD: tokeninit.c,v 1.8 2015/01/16 06:40:22 deraadt Exp $ */
/*-
* Copyright (c) 1995 Migration Associates Corp. All Rights Reserved
* BSDI $From: tokeninit.c,v 1.1 1996/08/26 20:27:28 prb Exp
*/
-#include <sys/param.h>
+#include <sys/signal.h>
#include <sys/resource.h>
#include <sys/time.h>
#include <syslog.h>
#include <stdlib.h>
#include <unistd.h>
+#include <limits.h>
#include <string.h>
#include <readpassphrase.h>
-/* $OpenBSD: traceroute.c,v 1.134 2014/12/09 17:46:24 millert Exp $ */
+/* $OpenBSD: traceroute.c,v 1.135 2015/01/16 06:40:22 deraadt Exp $ */
/* $NetBSD: traceroute.c,v 1.10 1995/05/21 15:50:45 mycroft Exp $ */
/*
* Tue Dec 20 03:50:13 PST 1988
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#define MAX_LSRR ((MAX_IPOPTLEN - 4) / 4)
const char *
inetname(struct sockaddr *sa)
{
- static char line[NI_MAXHOST], domain[MAXHOSTNAMELEN + 1];
+ static char line[NI_MAXHOST], domain[HOST_NAME_MAX+1 + 1];
static int first = 1;
char *cp;
-/* $OpenBSD: trpt.c,v 1.29 2014/11/26 18:34:52 millert Exp $ */
+/* $OpenBSD: trpt.c,v 1.30 2015/01/16 06:40:22 deraadt Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/socket.h>
#define PRUREQUESTS
-/* $OpenBSD: user.c,v 1.100 2014/08/27 06:51:35 sebastia Exp $ */
+/* $OpenBSD: user.c,v 1.101 2015/01/16 06:40:22 deraadt Exp $ */
/* $NetBSD: user.c,v 1.69 2003/04/14 17:40:07 agc Exp $ */
/*
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
#include <syslog.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include <util.h>
#include "defs.h"
/* some useful constants */
enum {
MaxShellNameLen = 256,
- MaxFileNameLen = MAXPATHLEN,
+ MaxFileNameLen = PATH_MAX,
MaxUserNameLen = _PW_NAME_LEN,
MaxCommandLen = 2048,
PasswordLength = _PASSWORD_LEN,
-/* $OpenBSD: watchdogd.c,v 1.14 2012/12/18 21:28:45 millert Exp $ */
+/* $OpenBSD: watchdogd.c,v 1.15 2015/01/16 06:40:22 deraadt Exp $ */
/*
* Copyright (c) 2005 Marc Balmer <mbalmer@openbsd.org>
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/resource.h>
+#include <sys/signal.h>
#include <sys/sysctl.h>
#include <sys/mman.h>
-/* $OpenBSD: ypbind.c,v 1.62 2014/01/21 23:05:09 jsg Exp $ */
+/* $OpenBSD: ypbind.c,v 1.63 2015/01/16 06:40:22 deraadt Exp $ */
/*
* Copyright (c) 1992, 1993, 1996, 1997, 1998 Theo de Raadt <deraadt@openbsd.org>
#include <net/if.h>
#include <stdio.h>
#include <stdlib.h>
+#include <limits.h>
#include <errno.h>
#include <ctype.h>
#include <netdb.h>
int dom_lockfd;
int dom_alive;
u_int32_t dom_xid;
- char dom_servlist[MAXPATHLEN];
+ char dom_servlist[PATH_MAX];
FILE *dom_servlistfp;
};
{
static struct ypbind_resp res;
struct _dom_binding *ypdb;
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
time_t now;
int count = 0;
int
main(int argc, char *argv[])
{
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
struct sockaddr_in sin;
struct timeval tv;
fd_set *fdsrp = NULL;
struct rpc_msg msg;
struct sockaddr_in bindsin;
char buf[1400];
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
enum clnt_stat st;
int outlen;
AUTH *rpcua;
struct _dom_binding *ypdb;
struct iovec iov[2];
struct ypbind_resp ybr;
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
int fd;
if (strchr(dom, '/'))
-/* $OpenBSD: ber.c,v 1.7 2010/06/14 13:46:08 martinh Exp $ */
+/* $OpenBSD: ber.c,v 1.8 2015/01/16 06:40:22 deraadt Exp $ */
/*
* Copyright (c) 2007 Reyk Floeter <reyk@vantronix.net>
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <errno.h>
#include <limits.h>
#include "ber.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
#define BER_TYPE_CONSTRUCTED 0x20 /* otherwise primitive */
#define BER_TYPE_SINGLE_MAX 30
return -1;
sz = b->br_rend - b->br_rptr;
- len = MIN(nbytes, sz);
+ len = MINIMUM(nbytes, sz);
if (len == 0) {
errno = ECANCELED;
return (-1); /* end of buffer and parser wants more data */
-/* $OpenBSD: entries.c,v 1.2 2011/08/28 11:53:16 aschrijver Exp $ */
+/* $OpenBSD: entries.c,v 1.3 2015/01/16 06:40:22 deraadt Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/tree.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include "ypldap.h"
-/* $OpenBSD: ldapclient.c,v 1.31 2014/11/16 23:24:44 tedu Exp $ */
+/* $OpenBSD: ldapclient.c,v 1.32 2015/01/16 06:40:22 deraadt Exp $ */
/*
* Copyright (c) 2008 Alexander Schrijver <aschrijver@openbsd.org>
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/socket.h>
+#include <sys/signal.h>
#include <sys/tree.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include "aldap.h"
#include "ypldap.h"
-/* $OpenBSD: parse.y,v 1.17 2014/11/20 05:51:21 jsg Exp $ */
+/* $OpenBSD: parse.y,v 1.18 2015/01/16 06:40:22 deraadt Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
#include <sys/time.h>
#include <sys/queue.h>
#include <sys/tree.h>
-#include <sys/param.h>
#include <sys/socket.h>
#include <sys/stat.h>
-/* $OpenBSD: yp.c,v 1.12 2013/10/01 12:00:34 deraadt Exp $ */
+/* $OpenBSD: yp.c,v 1.13 2015/01/16 06:40:22 deraadt Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
*
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include <rpc/rpc.h>
#include <rpc/xdr.h>
-/* $OpenBSD: ypldap.c,v 1.14 2014/07/13 15:38:09 krw Exp $ */
+/* $OpenBSD: ypldap.c,v 1.15 2015/01/16 06:40:22 deraadt Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/socket.h>
+#include <sys/signal.h>
#include <sys/tree.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include "ypldap.h"
-/* $OpenBSD: ypldap.h,v 1.15 2014/11/03 20:15:31 bluhm Exp $ */
+/* $OpenBSD: ypldap.h,v 1.16 2015/01/16 06:40:22 deraadt Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
struct idm {
TAILQ_ENTRY(idm) idm_entry;
u_int32_t idm_id;
- char idm_name[MAXHOSTNAMELEN];
+ char idm_name[HOST_NAME_MAX+1];
#define F_SSL 0x00100000
#define F_CONFIGURING 0x00200000
#define F_NEEDAUTH 0x00400000
u_int32_t sc_maxid;
- char sc_domainname[MAXHOSTNAMELEN];
+ char sc_domainname[HOST_NAME_MAX+1];
struct timeval sc_conf_tv;
struct event sc_conf_ev;
TAILQ_HEAD(idm_list, idm) sc_idms;
-/* $OpenBSD: ypldap_dns.c,v 1.7 2014/07/13 15:38:09 krw Exp $ */
+/* $OpenBSD: ypldap_dns.c,v 1.8 2015/01/16 06:40:22 deraadt Exp $ */
/*
* Copyright (c) 2003-2008 Henning Brauer <henning@openbsd.org>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
-#include <sys/param.h>
#include <sys/time.h>
#include <sys/tree.h>
#include <sys/queue.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include "ypldap.h"
-/* $OpenBSD: yppoll.c,v 1.14 2013/04/16 19:24:55 deraadt Exp $ */
+/* $OpenBSD: yppoll.c,v 1.15 2015/01/16 06:40:22 deraadt Exp $ */
/* $NetBSD: yppoll.c,v 1.5 1996/05/13 02:46:36 thorpej Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
-/* $OpenBSD: ypdb.c,v 1.11 2003/07/15 06:10:46 deraadt Exp $ */
+/* $OpenBSD: ypdb.c,v 1.12 2015/01/16 06:40:22 deraadt Exp $ */
/*
* Copyright (c) 1990, 1993
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
ypdb_open(const char *file, int flags, int mode)
{
BTREEINFO info;
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
DBM *db;
memset(&info, 0, sizeof info);
-/* $OpenBSD: yplib_host.c,v 1.17 2014/11/18 20:54:29 krw Exp $ */
+/* $OpenBSD: yplib_host.c,v 1.18 2015/01/16 06:40:22 deraadt Exp $ */
/*
* Copyright (c) 1992, 1993 Theo de Raadt <deraadt@theos.com>
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/file.h>
-/* $OpenBSD: db.c,v 1.8 2009/10/27 23:59:57 deraadt Exp $ */
+/* $OpenBSD: db.c,v 1.9 2015/01/16 06:40:23 deraadt Exp $ */
/*
* Copyright (c) 1997 Mats O Jansson <moj@stacken.kth.se>
#include <db.h>
#include <fcntl.h>
#include <stdio.h>
-#include <sys/param.h>
#include "db.h"
#include "ypdb.h"
DB *db;
int status;
DBT key, val;
- char path[MAXPATHLEN];
+ char path[PATH_MAX];
snprintf(path, sizeof(path), "%s%s", database, ".db");
-/* $OpenBSD: makedbm.c,v 1.31 2013/12/04 02:18:05 deraadt Exp $ */
+/* $OpenBSD: makedbm.c,v 1.32 2015/01/16 06:40:23 deraadt Exp $ */
/*
* Copyright (c) 1994-97 Mats O Jansson <moj@stacken.kth.se>
#include <fcntl.h>
#include <ctype.h>
#include <sys/stat.h>
-#include <sys/param.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
{
FILE *data_file;
char data_line[4096]; /* XXX: DB bsize = 4096 in ypdb.c */
- char myname[MAXHOSTNAMELEN];
+ char myname[HOST_NAME_MAX+1];
int line_no = 0, len;
char *p, *k, *v, *slash;
DBM *new_db;
static char mapname[] = "ypdbXXXXXXXXXX";
- char db_mapname[MAXPATHLEN], db_outfile[MAXPATHLEN];
- char db_tempname[MAXPATHLEN], empty_str[] = "";
+ char db_mapname[PATH_MAX], db_outfile[PATH_MAX];
+ char db_tempname[PATH_MAX], empty_str[] = "";
if (strcmp(infile,"-") == 0) {
data_file = stdin;
}
}
- if (strlen(database) + strlen(YPDB_SUFFIX) > MAXPATHLEN) {
+ if (strlen(database) + strlen(YPDB_SUFFIX) > PATH_MAX) {
fprintf(stderr,"%s: %s: file name too long\n",
__progname, database);
exit(1);
/* note: database is now directory where map goes ! */
if (strlen(database) + strlen(mapname) +
- strlen(YPDB_SUFFIX) > MAXPATHLEN) {
+ strlen(YPDB_SUFFIX) > PATH_MAX) {
fprintf(stderr,"%s: %s: directory name too long\n",
__progname, database);
exit(1);
-/* $OpenBSD: mkalias.c,v 1.26 2013/12/05 14:18:54 jca Exp $ */
+/* $OpenBSD: mkalias.c,v 1.27 2015/01/16 06:40:23 deraadt Exp $ */
/*
* Copyright (c) 1997 Mats O Jansson <moj@stacken.kth.se>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <sys/param.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
datum key, val;
DBM *new_db = NULL;
static char mapname[] = "ypdbXXXXXXXXXX";
- char db_mapname[MAXPATHLEN], db_outfile[MAXPATHLEN];
- char db_tempname[MAXPATHLEN];
+ char db_mapname[PATH_MAX], db_outfile[PATH_MAX];
+ char db_tempname[PATH_MAX];
char user[4096], host[4096]; /* XXX: DB bsize = 4096 in ypdb.c */
- char myname[MAXHOSTNAMELEN], datestr[11], *slash;
+ char myname[HOST_NAME_MAX+1], datestr[11], *slash;
while ((ch = getopt(argc, argv, "Edensuv")) != -1)
switch (ch) {
}
if (output != NULL) {
- if (strlen(output) + strlen(YPDB_SUFFIX) > MAXPATHLEN) {
+ if (strlen(output) + strlen(YPDB_SUFFIX) > PATH_MAX) {
errx(1, "%s: file name too long", output);
/* NOTREACHED */
}
/* note: output is now directory where map goes ! */
if (strlen(output) + strlen(mapname) +
- strlen(YPDB_SUFFIX) > MAXPATHLEN) {
+ strlen(YPDB_SUFFIX) > PATH_MAX) {
errx(1, "%s: directory name too long", output);
/* NOTREACHED */
}
-/* $OpenBSD: mknetid.c,v 1.20 2013/12/04 02:18:05 deraadt Exp $ */
+/* $OpenBSD: mknetid.c,v 1.21 2015/01/16 06:40:23 deraadt Exp $ */
/*
* Copyright (c) 1996 Mats O Jansson <moj@stacken.kth.se>
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <stdio.h>
#include <unistd.h>
#include <ctype.h>
#include <grp.h>
#include <err.h>
#include <netdb.h>
+#include <limits.h>
#include <rpcsvc/ypclnt.h>
int usr_uid; /* user uid */
int usr_gid; /* user gid */
int gid_count; /* number of gids */
- int gid[NGROUPS]; /* additional gids */
+ int gid[NGROUPS_MAX]; /* additional gids */
struct user *prev, *next; /* links in read order */
struct user *hprev, *hnext; /* links in hash order */
};
if (strcmp(username, u->usr_name) == 0) {
if (g != u->usr_gid) {
u->gid_count++;
- if (u->gid_count < NGROUPS)
+ if (u->gid_count < NGROUPS_MAX)
u->gid[u->gid_count] = atoi(gid);
}
u = htail[idx];
-/* $OpenBSD: yppush.c,v 1.30 2014/11/04 16:16:03 deraadt Exp $ */
+/* $OpenBSD: yppush.c,v 1.31 2015/01/16 06:40:23 deraadt Exp $ */
/*
* Copyright (c) 1995 Mats O Jansson <moj@stacken.kth.se>
#include "ypdb.h"
int Verbose = 0;
-char Domain[MAXHOSTNAMELEN], Map[255];
+char Domain[HOST_NAME_MAX+1], Map[255];
u_int32_t OrderNum;
char *master;
static void
push(int inlen, char *indata)
{
- char host[MAXHOSTNAMELEN];
+ char host[HOST_NAME_MAX+1];
CLIENT *client;
SVCXPRT *transp;
int sock = RPC_ANYSOCK, status;
int c, r, i;
char *ypmap = "ypservers";
CLIENT *client;
- static char map_path[MAXPATHLEN];
+ static char map_path[PATH_MAX];
struct stat finfo;
DBM *yp_databas;
char order_key[YP_LAST_LEN] = YP_LAST_KEY;
-/* $OpenBSD: ypserv_db.c,v 1.28 2013/12/05 17:36:12 jca Exp $ */
+/* $OpenBSD: ypserv_db.c,v 1.29 2015/01/16 06:40:23 deraadt Exp $ */
/*
* Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se>
#include <rpcsvc/yp.h>
#include <rpcsvc/ypclnt.h>
#include <sys/stat.h>
-#include <sys/param.h>
#include <fcntl.h>
#include <string.h>
#include <stdio.h>
ypdb_open_db(domainname domain, mapname map, ypstat *status,
struct opt_map **map_info)
{
- char map_path[MAXPATHLEN];
+ char map_path[PATH_MAX];
static char *domain_key = YP_INTERDOMAIN_KEY;
static char *secure_key = YP_SECURE_KEY;
DBM *db;
struct in_addr *addr_name;
struct in_addr addr_addr;
static char val[BUFSIZ+1]; /* match libc */
- static char hostname[MAXHOSTNAMELEN];
- char tmpbuf[MAXHOSTNAMELEN + 20], *v, *ptr;
+ static char hostname[HOST_NAME_MAX+1];
+ char tmpbuf[HOST_NAME_MAX+1 + 20], *v, *ptr;
size_t len;
int l;
-/* $OpenBSD: ypserv_proc.c,v 1.28 2014/02/24 06:45:56 jsg Exp $ */
+/* $OpenBSD: ypserv_proc.c,v 1.29 2015/01/16 06:40:23 deraadt Exp $ */
/*
* Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se>
#include <rpcsvc/ypclnt.h>
#include <sys/stat.h>
#include <sys/socket.h>
-#include <sys/param.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "ypdb.h"
{
struct sockaddr_in *caller = svc_getcaller(rqstp->rq_xprt);
int ok = acl_check_host(&caller->sin_addr);
- static char domain_path[MAXPATHLEN];
+ static char domain_path[PATH_MAX];
static bool_t result;
struct stat finfo;
static bool_t result; /* is domain served? */
struct sockaddr_in *caller = svc_getcaller(rqstp->rq_xprt);
int ok = acl_check_host(&caller->sin_addr);
- static char domain_path[MAXPATHLEN];
+ static char domain_path[PATH_MAX];
struct stat finfo;
if (strchr(*argp, '/'))
static ypresp_maplist res;
struct sockaddr_in *caller = svc_getcaller(rqstp->rq_xprt);
int ok = acl_check_host(&caller->sin_addr);
- static char domain_path[MAXPATHLEN];
+ static char domain_path[PATH_MAX];
struct stat finfo;
DIR *dirp = NULL;
struct dirent *dp;
static bool_t result; /* is domain_served? */
struct sockaddr_in *caller = svc_getcaller(rqstp->rq_xprt);
int ok = acl_check_host(&caller->sin_addr);
- static char domain_path[MAXPATHLEN];
+ static char domain_path[PATH_MAX];
struct stat finfo;
if (strchr(*argp, '/'))
static bool_t result; /* is domain served? */
struct sockaddr_in *caller = svc_getcaller(rqstp->rq_xprt);
int ok = acl_check_host(&caller->sin_addr);
- static char domain_path[MAXPATHLEN];
+ static char domain_path[PATH_MAX];
struct stat finfo;
if (strchr(*argp, '/'))
-/* $OpenBSD: ypxfr.c,v 1.37 2009/10/27 23:59:58 deraadt Exp $ */
+/* $OpenBSD: ypxfr.c,v 1.38 2015/01/16 06:40:23 deraadt Exp $ */
/*
* Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se>
static int
get_local_ordernum(char *domain, char *map, u_int32_t *lordernum)
{
- char map_path[MAXPATHLEN], order[MAX_LAST_LEN+1];
+ char map_path[PATH_MAX], order[MAX_LAST_LEN+1];
char order_key[] = YP_LAST_KEY;
struct stat finfo;
datum k, v;
static int
install_db(char *domain, char *map, char *temp_map)
{
- char db_name[MAXPATHLEN];
+ char db_name[PATH_MAX];
snprintf(db_name, sizeof db_name, "%s/%s/%s%s",
YP_DB_PATH, domain, map, YPDB_SUFFIX);
}
if (status == YPPUSH_SUCC) {
- char tmpmapname[MAXPATHLEN];
+ char tmpmapname[PATH_MAX];
int fd;
/* Create temporary db */
-/* $OpenBSD: ypset.c,v 1.19 2009/10/27 23:59:58 deraadt Exp $ */
+/* $OpenBSD: ypset.c,v 1.20 2015/01/16 06:40:23 deraadt Exp $ */
/* $NetBSD: ypset.c,v 1.8 1996/05/13 02:46:33 thorpej Exp $ */
/*
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <err.h>
-/* $OpenBSD: ztsscale.c,v 1.17 2014/09/27 06:28:45 doug Exp $ */
+/* $OpenBSD: ztsscale.c,v 1.18 2015/01/16 06:40:23 deraadt Exp $ */
/*
* Copyright (c) 2005 Matthieu Herrb
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <machine/cpu.h>