533) Fixed several issues when closing all open descriptors. Sudo now uses
closefrom() if it exists.
+
+534) Use PATH_MAX, not MAXPATHLEN since the former is standardized.
#else
# include "emul/err.h"
#endif /* HAVE_ERR_H */
-#include <limits.h>
#include "sudo.h"
dirparent = def_timestampdir;
len = easprintf(timestampdir, "%s/%s", dirparent, user_name);
- if (len >= MAXPATHLEN)
+ if (len >= PATH_MAX)
log_error(0, "timestamp path too long: %s", timestampdir);
/*
p, *user_runas);
else
len = easprintf(timestampfile, "%s/%s/%s", dirparent, user_name, p);
- if (len >= MAXPATHLEN)
+ if (len >= PATH_MAX)
log_error(0, "timestamp path too long: %s", timestampfile);
} else if (def_targetpw) {
len = easprintf(timestampfile, "%s/%s/%s", dirparent, user_name,
*user_runas);
- if (len >= MAXPATHLEN)
+ if (len >= PATH_MAX)
log_error(0, "timestamp path too long: %s", timestampfile);
} else
*timestampfile = NULL;
#endif /* __P */
/*
- * Some systems (ie ISC V/386) do not define MAXPATHLEN even in param.h
+ * Some systems do not define PATH_MAX.
*/
-#ifndef MAXPATHLEN
-# define MAXPATHLEN 1024
+#ifndef PATH_MAX
+# ifdef MAXPATHLEN
+# define PATH_MAX MAXPATHLEN
+# else
+# ifdef _POSIX_PATH_MAX
+# define PATH_MAX _POSIX_PATH_MAX
+# else
+# define PATH_MAX 1024
+# endif
+# endif
#endif
/*
char **outfile; /* result parameter */
char *path; /* path to search */
{
- static char command[MAXPATHLEN]; /* qualified filename */
+ static char command[PATH_MAX]; /* qualified filename */
char *n; /* for traversing path */
char *origpath; /* so we can free path later */
char *result = NULL; /* result of path/file lookup */
int checkdot = 0; /* check current dir? */
int len; /* length parameter */
- if (strlen(infile) >= MAXPATHLEN)
+ if (strlen(infile) >= PATH_MAX)
errx(1, "%s: File name too long", infile);
/*
*/
if ((up = malloc(upsize = 1024 - 4)) == NULL)
goto err;
- eup = up + MAXPATHLEN;
+ eup = up + PATH_MAX;
bup = up;
up[0] = '.';
up[1] = '\0';
struct stat pst;
DIR *dirp;
struct dirent *dent;
- char buf[MAXPATHLEN];
+ char buf[PATH_MAX];
static char *cmnd_base;
/* Check for pseudo-commands */
return(FALSE);
while ((dent = readdir(dirp)) != NULL) {
- /* ignore paths > MAXPATHLEN (XXX - log) */
+ /* ignore paths > PATH_MAX (XXX - log) */
if (strlcpy(buf, path, sizeof(buf)) >= sizeof(buf) ||
strlcat(buf, dent->d_name, sizeof(buf)) >= sizeof(buf))
continue;
int nohostname, rval;
/* Sanity check command from user. */
- if (user_cmnd == NULL && strlen(NewArgv[0]) >= MAXPATHLEN)
+ if (user_cmnd == NULL && strlen(NewArgv[0]) >= PATH_MAX)
errx(1, "%s: File name too long", NewArgv[0]);
#ifdef HAVE_TZSET
#define _SUDO_SUDO_H
#include <pathnames.h>
+#include <limits.h>
#include "compat.h"
#include "defaults.h"
#include "logging.h"
char *path;
char *shell;
char *tty;
- char cwd[MAXPATHLEN];
+ char cwd[PATH_MAX];
char *host;
char *shost;
char **runas;
int argc;
char **argv;
{
- char buf[MAXPATHLEN*2]; /* buffer used for copying files */
+ char buf[PATH_MAX*2]; /* buffer used for copying files */
char *Editor; /* editor to use */
char *UserEditor; /* editor user wants to use */
char *EditorPath; /* colon-separated list of editors */