From: millert Date: Wed, 14 Jan 2015 17:30:53 +0000 (+0000) Subject: Replace MAXHOSTNAMELEN with HOST_NAME_MAX+1 and MAXNAMLEN with NAME_MAX X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=75e8a723db6084275296e9579b068154b22fd7df;p=openbsd Replace MAXHOSTNAMELEN with HOST_NAME_MAX+1 and MAXNAMLEN with NAME_MAX and use limits.h instead of sys/param.h. --- diff --git a/usr.sbin/cron/atrun.c b/usr.sbin/cron/atrun.c index 26c17da6c00..99be7e09611 100644 --- a/usr.sbin/cron/atrun.c +++ b/usr.sbin/cron/atrun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atrun.c,v 1.22 2015/01/14 17:27:51 millert Exp $ */ +/* $OpenBSD: atrun.c,v 1.23 2015/01/14 17:30:53 millert Exp $ */ /* * Copyright (c) 2002-2003 Todd C. Miller @@ -526,7 +526,7 @@ run_job(atjob *job, char *atfile) size_t bytes = 0; int status = 0; char mailcmd[MAX_COMMAND]; - char hostname[MAXHOSTNAMELEN]; + char hostname[HOST_NAME_MAX + 1]; Debug(DPROC|DEXT, ("[%ld] got data from grandchild\n", (long)getpid())) diff --git a/usr.sbin/cron/database.c b/usr.sbin/cron/database.c index 2d98f0db294..ff1c5806533 100644 --- a/usr.sbin/cron/database.c +++ b/usr.sbin/cron/database.c @@ -1,4 +1,4 @@ -/* $OpenBSD: database.c,v 1.20 2015/01/14 17:27:29 millert Exp $ */ +/* $OpenBSD: database.c,v 1.21 2015/01/14 17:30:53 millert Exp $ */ /* Copyright 1988,1990,1993,1994 by Paul Vixie * All rights reserved @@ -92,7 +92,7 @@ load_database(cron_db *old_db) { } while (NULL != (dp = readdir(dir))) { - char fname[MAXNAMLEN+1], tabname[MAXNAMLEN]; + char fname[NAME_MAX+1], tabname[MAX_FNAME]; /* avoid file names beginning with ".". this is good * because we would otherwise waste two guaranteed calls diff --git a/usr.sbin/cron/do_command.c b/usr.sbin/cron/do_command.c index 3f650b19a65..970276e8915 100644 --- a/usr.sbin/cron/do_command.c +++ b/usr.sbin/cron/do_command.c @@ -1,4 +1,4 @@ -/* $OpenBSD: do_command.c,v 1.40 2015/01/14 17:27:51 millert Exp $ */ +/* $OpenBSD: do_command.c,v 1.41 2015/01/14 17:30:53 millert Exp $ */ /* Copyright 1988,1990,1993,1994 by Paul Vixie * All rights reserved @@ -400,7 +400,7 @@ child_process(entry *e, user *u) { if (mailto) { char **env; char mailcmd[MAX_COMMAND]; - char hostname[MAXHOSTNAMELEN]; + char hostname[HOST_NAME_MAX + 1]; gethostname(hostname, sizeof(hostname)); if (snprintf(mailcmd, sizeof mailcmd, MAILFMT, diff --git a/usr.sbin/cron/externs.h b/usr.sbin/cron/externs.h index ee5d4e52e54..725dbd89376 100644 --- a/usr.sbin/cron/externs.h +++ b/usr.sbin/cron/externs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: externs.h,v 1.14 2015/01/14 17:27:30 millert Exp $ */ +/* $OpenBSD: externs.h,v 1.15 2015/01/14 17:30:53 millert Exp $ */ /* Copyright 1993,1994 by Paul Vixie * All rights reserved @@ -23,7 +23,6 @@ /* reorder these #include's at your peril */ -#include #include #include #include @@ -38,6 +37,7 @@ #include #include #include +#include #include #include #include diff --git a/usr.sbin/cron/macros.h b/usr.sbin/cron/macros.h index 925d48ad9ee..c9b5d4adb2e 100644 --- a/usr.sbin/cron/macros.h +++ b/usr.sbin/cron/macros.h @@ -1,4 +1,4 @@ -/* $OpenBSD: macros.h,v 1.8 2013/11/23 18:06:49 deraadt Exp $ */ +/* $OpenBSD: macros.h,v 1.9 2015/01/14 17:30:53 millert Exp $ */ /* * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") @@ -58,10 +58,6 @@ #define PPC_NULL ((const char **)NULL) -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 64 -#endif - #define Skip_Blanks(c, f) \ while (c == '\t' || c == ' ') \ c = get_char(f);