Switch to limits.h; replace MAXPATHLEN and MAXHOSTNAMELEN with PATH_MAX

and HOST_NAME_MAX+1, respectively.

ok doug@
This commit is contained in:
okan 2015-01-19 14:54:16 +00:00
parent 4d0cbdc03c
commit c199720bcc
15 changed files with 48 additions and 35 deletions

View File

@ -15,16 +15,17 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: calmwm.c,v 1.92 2014/09/08 20:11:22 okan Exp $
* $OpenBSD: calmwm.c,v 1.93 2015/01/19 14:54:16 okan Exp $
*/
#include <sys/param.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/wait.h>
#include <err.h>
#include <errno.h>
#include <getopt.h>
#include <limits.h>
#include <locale.h>
#include <pwd.h>
#include <signal.h>

View File

@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: calmwm.h,v 1.283 2014/10/08 12:48:51 okan Exp $
* $OpenBSD: calmwm.h,v 1.284 2015/01/19 14:54:16 okan Exp $
*/
#ifndef _CALMWM_H_
@ -260,7 +260,7 @@ TAILQ_HEAD(mousebinding_q, binding);
struct cmd {
TAILQ_ENTRY(cmd) entry;
char *name;
char path[MAXPATHLEN];
char path[PATH_MAX];
};
TAILQ_HEAD(cmd_q, cmd);
@ -292,7 +292,7 @@ struct conf {
int snapdist;
struct gap gap;
char *color[CWM_COLOR_NITEMS];
char known_hosts[MAXPATHLEN];
char known_hosts[PATH_MAX];
#define CONF_FONT "sans-serif:pixelsize=14:bold"
char *font;
Cursor cursor[CF_NITEMS];

View File

@ -15,15 +15,16 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: client.c,v 1.188 2014/09/27 19:04:32 okan Exp $
* $OpenBSD: client.c,v 1.189 2015/01/19 14:54:16 okan Exp $
*/
#include <sys/param.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <assert.h>
#include <err.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -15,15 +15,16 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: conf.c,v 1.181 2014/09/17 18:41:44 okan Exp $
* $OpenBSD: conf.c,v 1.182 2015/01/19 14:54:16 okan Exp $
*/
#include <sys/param.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/stat.h>
#include <err.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -16,15 +16,16 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: group.c,v 1.109 2014/10/08 12:48:51 okan Exp $
* $OpenBSD: group.c,v 1.110 2015/01/19 14:54:16 okan Exp $
*/
#include <sys/param.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <assert.h>
#include <err.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -15,15 +15,16 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: kbfunc.c,v 1.104 2014/09/27 19:04:32 okan Exp $
* $OpenBSD: kbfunc.c,v 1.105 2015/01/19 14:54:16 okan Exp $
*/
#include <sys/param.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <dirent.h>
#include <err.h>
#include <errno.h>
#include <limits.h>
#include <paths.h>
#include <signal.h>
#include <stdio.h>
@ -238,7 +239,7 @@ kbfunc_exec(struct client_ctx *cc, union arg *arg)
#define NPATHS 256
struct screen_ctx *sc = cc->sc;
char **ap, *paths[NPATHS], *path, *pathcpy;
char tpath[MAXPATHLEN];
char tpath[PATH_MAX];
const char *label;
DIR *dirp;
struct dirent *dp;
@ -323,8 +324,8 @@ kbfunc_ssh(struct client_ctx *cc, union arg *arg)
struct menu_q menuq;
FILE *fp;
char *buf, *lbuf, *p;
char hostbuf[MAXHOSTNAMELEN];
char path[MAXPATHLEN];
char hostbuf[HOST_NAME_MAX+1];
char path[PATH_MAX];
int l;
size_t len;

View File

@ -16,15 +16,16 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: menu.c,v 1.77 2014/09/07 19:27:30 okan Exp $
* $OpenBSD: menu.c,v 1.78 2015/01/19 14:54:16 okan Exp $
*/
#include <sys/param.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>

View File

@ -16,14 +16,15 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: mousefunc.c,v 1.85 2014/09/27 19:04:32 okan Exp $
* $OpenBSD: mousefunc.c,v 1.86 2015/01/19 14:54:16 okan Exp $
*/
#include <sys/param.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <err.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -1,4 +1,4 @@
/* $OpenBSD: parse.y,v 1.60 2015/01/17 02:05:03 okan Exp $ */
/* $OpenBSD: parse.y,v 1.61 2015/01/19 14:54:16 okan Exp $ */
/*
* Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -21,7 +21,7 @@
%{
#include <sys/param.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <ctype.h>

View File

@ -15,14 +15,15 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: screen.c,v 1.70 2014/10/08 15:31:01 okan Exp $
* $OpenBSD: screen.c,v 1.71 2015/01/19 14:54:16 okan Exp $
*/
#include <sys/param.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <err.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -15,10 +15,10 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: search.c,v 1.41 2014/09/15 13:00:49 okan Exp $
* $OpenBSD: search.c,v 1.42 2015/01/19 14:54:16 okan Exp $
*/
#include <sys/param.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <assert.h>
@ -26,6 +26,7 @@
#include <errno.h>
#include <fnmatch.h>
#include <glob.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -172,7 +173,7 @@ search_print_client(struct menu *mi, int list)
static void
search_match_path(struct menu_q *menuq, struct menu_q *resultq, char *search, int flag)
{
char pattern[MAXPATHLEN];
char pattern[PATH_MAX];
glob_t g;
int i;

View File

@ -15,14 +15,15 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: util.c,v 1.16 2012/11/09 03:52:02 okan Exp $
* $OpenBSD: util.c,v 1.17 2015/01/19 14:54:16 okan Exp $
*/
#include <sys/param.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <err.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: xevents.c,v 1.115 2014/09/27 19:04:32 okan Exp $
* $OpenBSD: xevents.c,v 1.116 2015/01/19 14:54:16 okan Exp $
*/
/*
@ -24,11 +24,12 @@
* management of the xevent's.
*/
#include <sys/param.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <err.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -15,14 +15,15 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: xmalloc.c,v 1.13 2014/09/07 19:27:30 okan Exp $
* $OpenBSD: xmalloc.c,v 1.14 2015/01/19 14:54:16 okan Exp $
*/
#include <sys/param.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <err.h>
#include <errno.h>
#include <limits.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>

View File

@ -15,14 +15,15 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: xutil.c,v 1.96 2014/09/23 14:25:08 okan Exp $
* $OpenBSD: xutil.c,v 1.97 2015/01/19 14:54:16 okan Exp $
*/
#include <sys/param.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <err.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>