summaryrefslogtreecommitdiffstats
path: root/bin/csh/dir.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2015-01-16 06:39:28 +0000
committerderaadt <deraadt@openbsd.org>2015-01-16 06:39:28 +0000
commitb9fc9a728fce9c4289b7e9a992665e28d5629a54 (patch)
tree72b2433e418dfa1aef5fcf8305617b97979a25d8 /bin/csh/dir.c
parentimprove checksum parsing slightly. now handles filenames with spaces. (diff)
downloadwireguard-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/dir.c')
-rw-r--r--bin/csh/dir.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/bin/csh/dir.c b/bin/csh/dir.c
index a4b81eb512c..ce9eb6e0fc3 100644
--- a/bin/csh/dir.c
+++ b/bin/csh/dir.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*-
@@ -30,12 +30,12 @@
* 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"
@@ -66,11 +66,11 @@ dinit(Char *hp)
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) {
@@ -405,7 +405,7 @@ dfollow(Char *cp)
{
Char *dp;
struct varent *c;
- char ebuf[MAXPATHLEN];
+ char ebuf[PATH_MAX];
int serrno;
cp = globone(cp, G_ERROR);
@@ -428,7 +428,7 @@ dfollow(Char *cp)
&& (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';)
@@ -610,8 +610,8 @@ dcanon(Char *cp, Char *p)
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;
@@ -620,12 +620,12 @@ dcanon(Char *cp, Char *p)
* 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));