Some systems (HURD) use fully-dynamic pathnames, with no limit.
We can't support this without significant effort so for now set
PATH_MAX to a large value.
* src/makeint.h: Set PATH_MAX to 4096 if not set and MAXPATHLEN
is also not set. Remove MAXPATHLEN setting: we won't use it.
* src/misc.c (get_path_max): If we can't get the path max via
pathconf() use the default PATH_MAX.
* src/dir.c (find_directory) [W32]: Use MAX_PATH not MAXPATHLEN.
(local_stat) [W32]: Ditto.
* src/job.c (create_batch_file) [W32]: Ditto.
* src/remake.c (name_mtime) [W32]: Ditto.
* src/w32/w32os.c (os_anontmp) [W32]: Ditto.
/* See if the directory exists. */
#if defined(WINDOWS32)
{
- char tem[MAXPATHLEN], *tstart, *tend;
+ char tem[MAX_PATH+1], *tstart, *tend;
size_t len = strlen (name);
/* Remove any trailing slashes. Windows32 stat fails even on
foo/. => foo without checking first that foo is a directory. */
if (plen > 2 && path[plen - 1] == '.' && ISDIRSEP (path[plen - 2]))
{
- char parent[MAXPATHLEN+1];
+ char parent[MAX_PATH+1];
- strncpy (parent, path, MAXPATHLEN);
- parent[MIN(plen - 2, MAXPATHLEN)] = '\0';
+ strncpy (parent, path, MAX_PATH);
+ parent[MIN(plen - 2, MAX_PATH)] = '\0';
if (stat (parent, buf) < 0 || !_S_ISDIR (buf->st_mode))
return -1;
}
{
const char *const ext = unixy ? "sh" : "bat";
const char *error_string = NULL;
- char temp_path[MAXPATHLEN]; /* need to know its length */
+ char temp_path[MAX_PATH+1]; /* need to know its length */
unsigned path_size = GetTempPath (sizeof temp_path, temp_path);
int path_is_dot = 0;
/* The following variable is static so we won't try to reuse a name
#endif
#ifndef PATH_MAX
-# ifndef POSIX
+# ifdef MAXPATHLEN
# define PATH_MAX MAXPATHLEN
+# else
+/* Some systems (HURD) have fully dynamic pathnames with no maximum.
+ Ideally we'd support this but it will take some work. */
+# define PATH_MAX 4096
# endif
#endif
-#ifndef MAXPATHLEN
-# define MAXPATHLEN 1024
-#endif
#ifdef PATH_MAX
# define GET_PATH_MAX PATH_MAX
if (value == 0)
{
- long int x = pathconf ("/", _PC_PATH_MAX);
+ long x = pathconf ("/", _PC_PATH_MAX);
if (x > 0)
- value = x;
+ value = (unsigned int) x;
else
- return MAXPATHLEN;
+ value = PATH_MAX;
}
return value;
#include <starlet.h>
#endif
#ifdef WINDOWS32
+#include <windows.h>
#include <io.h>
#include <sys/stat.h>
#if defined(_MSC_VER) && _MSC_VER > 1200
#if defined(WINDOWS32)
{
- char tem[MAXPATHLEN], *tstart, *tend;
+ char tem[MAX_PATH+1], *tstart, *tend;
const char *p = name + strlen (name);
/* Remove any trailing slashes and "."/"..". MS-Windows stat
int
os_anontmp ()
{
- char temp_path[MAXPATHLEN];
+ char temp_path[MAX_PATH+1];
unsigned path_size = GetTempPath (sizeof (temp_path), temp_path);
int using_cwd = 0;