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 c412f040df
commit 7936b9b2a7
15 changed files with 33 additions and 20 deletions

View File

@ -18,13 +18,14 @@
* $OpenBSD$ * $OpenBSD$
*/ */
#include <sys/param.h> #include <sys/types.h>
#include <sys/queue.h> #include <sys/queue.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <err.h> #include <err.h>
#include <errno.h> #include <errno.h>
#include <getopt.h> #include <getopt.h>
#include <limits.h>
#include <locale.h> #include <locale.h>
#include <pwd.h> #include <pwd.h>
#include <signal.h> #include <signal.h>

View File

@ -260,7 +260,7 @@ TAILQ_HEAD(mousebinding_q, binding);
struct cmd { struct cmd {
TAILQ_ENTRY(cmd) entry; TAILQ_ENTRY(cmd) entry;
char *name; char *name;
char path[MAXPATHLEN]; char path[PATH_MAX];
}; };
TAILQ_HEAD(cmd_q, cmd); TAILQ_HEAD(cmd_q, cmd);
@ -292,7 +292,7 @@ struct conf {
int snapdist; int snapdist;
struct gap gap; struct gap gap;
char *color[CWM_COLOR_NITEMS]; char *color[CWM_COLOR_NITEMS];
char known_hosts[MAXPATHLEN]; char known_hosts[PATH_MAX];
#define CONF_FONT "sans-serif:pixelsize=14:bold" #define CONF_FONT "sans-serif:pixelsize=14:bold"
char *font; char *font;
Cursor cursor[CF_NITEMS]; Cursor cursor[CF_NITEMS];

View File

@ -18,12 +18,13 @@
* $OpenBSD$ * $OpenBSD$
*/ */
#include <sys/param.h> #include <sys/types.h>
#include <sys/queue.h> #include <sys/queue.h>
#include <assert.h> #include <assert.h>
#include <err.h> #include <err.h>
#include <errno.h> #include <errno.h>
#include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

3
conf.c
View File

@ -18,12 +18,13 @@
* $OpenBSD$ * $OpenBSD$
*/ */
#include <sys/param.h> #include <sys/types.h>
#include <sys/queue.h> #include <sys/queue.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <err.h> #include <err.h>
#include <errno.h> #include <errno.h>
#include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@ -19,12 +19,13 @@
* $OpenBSD$ * $OpenBSD$
*/ */
#include <sys/param.h> #include <sys/types.h>
#include <sys/queue.h> #include <sys/queue.h>
#include <assert.h> #include <assert.h>
#include <err.h> #include <err.h>
#include <errno.h> #include <errno.h>
#include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@ -18,12 +18,13 @@
* $OpenBSD$ * $OpenBSD$
*/ */
#include <sys/param.h> #include <sys/types.h>
#include <sys/queue.h> #include <sys/queue.h>
#include <dirent.h> #include <dirent.h>
#include <err.h> #include <err.h>
#include <errno.h> #include <errno.h>
#include <limits.h>
#include <paths.h> #include <paths.h>
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
@ -238,7 +239,7 @@ kbfunc_exec(struct client_ctx *cc, union arg *arg)
#define NPATHS 256 #define NPATHS 256
struct screen_ctx *sc = cc->sc; struct screen_ctx *sc = cc->sc;
char **ap, *paths[NPATHS], *path, *pathcpy; char **ap, *paths[NPATHS], *path, *pathcpy;
char tpath[MAXPATHLEN]; char tpath[PATH_MAX];
const char *label; const char *label;
DIR *dirp; DIR *dirp;
struct dirent *dp; struct dirent *dp;
@ -323,8 +324,8 @@ kbfunc_ssh(struct client_ctx *cc, union arg *arg)
struct menu_q menuq; struct menu_q menuq;
FILE *fp; FILE *fp;
char *buf, *lbuf, *p; char *buf, *lbuf, *p;
char hostbuf[MAXHOSTNAMELEN]; char hostbuf[HOST_NAME_MAX+1];
char path[MAXPATHLEN]; char path[PATH_MAX];
int l; int l;
size_t len; size_t len;

3
menu.c
View File

@ -19,12 +19,13 @@
* $OpenBSD$ * $OpenBSD$
*/ */
#include <sys/param.h> #include <sys/types.h>
#include <sys/queue.h> #include <sys/queue.h>
#include <ctype.h> #include <ctype.h>
#include <err.h> #include <err.h>
#include <errno.h> #include <errno.h>
#include <limits.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -19,11 +19,12 @@
* $OpenBSD$ * $OpenBSD$
*/ */
#include <sys/param.h> #include <sys/types.h>
#include <sys/queue.h> #include <sys/queue.h>
#include <err.h> #include <err.h>
#include <errno.h> #include <errno.h>
#include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@ -21,7 +21,7 @@
%{ %{
#include <sys/param.h> #include <sys/types.h>
#include <sys/queue.h> #include <sys/queue.h>
#include <ctype.h> #include <ctype.h>

View File

@ -18,11 +18,12 @@
* $OpenBSD$ * $OpenBSD$
*/ */
#include <sys/param.h> #include <sys/types.h>
#include <sys/queue.h> #include <sys/queue.h>
#include <err.h> #include <err.h>
#include <errno.h> #include <errno.h>
#include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@ -18,7 +18,7 @@
* $OpenBSD$ * $OpenBSD$
*/ */
#include <sys/param.h> #include <sys/types.h>
#include <sys/queue.h> #include <sys/queue.h>
#include <assert.h> #include <assert.h>
@ -26,6 +26,7 @@
#include <errno.h> #include <errno.h>
#include <fnmatch.h> #include <fnmatch.h>
#include <glob.h> #include <glob.h>
#include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -172,7 +173,7 @@ search_print_client(struct menu *mi, int list)
static void static void
search_match_path(struct menu_q *menuq, struct menu_q *resultq, char *search, int flag) 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; glob_t g;
int i; int i;

3
util.c
View File

@ -18,11 +18,12 @@
* $OpenBSD$ * $OpenBSD$
*/ */
#include <sys/param.h> #include <sys/types.h>
#include <sys/queue.h> #include <sys/queue.h>
#include <err.h> #include <err.h>
#include <errno.h> #include <errno.h>
#include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@ -24,11 +24,12 @@
* management of the xevent's. * management of the xevent's.
*/ */
#include <sys/param.h> #include <sys/types.h>
#include <sys/queue.h> #include <sys/queue.h>
#include <err.h> #include <err.h>
#include <errno.h> #include <errno.h>
#include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@ -18,11 +18,12 @@
* $OpenBSD$ * $OpenBSD$
*/ */
#include <sys/param.h> #include <sys/types.h>
#include <sys/queue.h> #include <sys/queue.h>
#include <err.h> #include <err.h>
#include <errno.h> #include <errno.h>
#include <limits.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>

View File

@ -18,11 +18,12 @@
* $OpenBSD$ * $OpenBSD$
*/ */
#include <sys/param.h> #include <sys/types.h>
#include <sys/queue.h> #include <sys/queue.h>
#include <err.h> #include <err.h>
#include <errno.h> #include <errno.h>
#include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>