diff options
| author | 2015-01-16 06:39:28 +0000 | |
|---|---|---|
| committer | 2015-01-16 06:39:28 +0000 | |
| commit | b9fc9a728fce9c4289b7e9a992665e28d5629a54 (patch) | |
| tree | 72b2433e418dfa1aef5fcf8305617b97979a25d8 /bin/csh/file.c | |
| parent | improve checksum parsing slightly. now handles filenames with spaces. (diff) | |
| download | wireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.tar.xz wireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.zip | |
Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)
Diffstat (limited to 'bin/csh/file.c')
| -rw-r--r-- | bin/csh/file.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/bin/csh/file.c b/bin/csh/file.c index 11961e6e37a..40730e7c08d 100644 --- a/bin/csh/file.c +++ b/bin/csh/file.c @@ -1,4 +1,4 @@ -/* $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 $ */ /*- @@ -32,7 +32,7 @@ #ifdef FILEC -#include <sys/param.h> +#include <sys/types.h> #include <sys/ioctl.h> #include <sys/stat.h> #include <termios.h> @@ -40,6 +40,7 @@ #include <pwd.h> #include <stdlib.h> #include <unistd.h> +#include <limits.h> #ifndef SHORT_STRINGS #include <string.h> #endif /* SHORT_STRINGS */ @@ -200,7 +201,7 @@ copyn(Char *des, Char *src, int count) static Char filetype(Char *dir, Char *file) { - Char path[MAXPATHLEN]; + Char path[PATH_MAX]; struct stat statb; Strlcpy(path, dir, sizeof path/sizeof(Char)); @@ -281,7 +282,7 @@ tilde(Char *new, Char *old) static Char person[40]; if (old[0] != '~') { - Strlcpy(new, old, MAXPATHLEN); + Strlcpy(new, old, PATH_MAX); return new; } @@ -289,14 +290,14 @@ tilde(Char *new, Char *old) 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); } @@ -417,7 +418,7 @@ tsearch(Char *word, COMMAND command, int max_word_length) 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; |
