Remplacer MAXPATHLEN par PATH_MAX
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1993 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
840152fd2d
commit
df00b2c58d
|
@ -15,17 +15,23 @@
|
|||
#include <alloc.h>
|
||||
#include "unixsupport.h"
|
||||
|
||||
#ifdef HAS_GETCWD
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <sys/param.h>
|
||||
#else
|
||||
#define MAXPATHLEN 512
|
||||
#endif
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#ifdef MAXPATHLEN
|
||||
#define PATH_MAN MAXPATHLEN
|
||||
#else
|
||||
#define PATH_MAX 512
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAS_GETCWD
|
||||
|
||||
value unix_getcwd(value unit) /* ML */
|
||||
{
|
||||
char buff[MAXPATHLEN];
|
||||
char buff[PATH_MAX];
|
||||
if (getcwd(buff, sizeof(buff)) == 0) uerror("getcwd", Nothing);
|
||||
return copy_string(buff);
|
||||
}
|
||||
|
@ -33,11 +39,9 @@ value unix_getcwd(value unit) /* ML */
|
|||
#else
|
||||
#ifdef HAS_GETWD
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
value unix_getcwd(value unit)
|
||||
{
|
||||
char buff[MAXPATHLEN];
|
||||
char buff[PATH_MAX];
|
||||
if (getwd(buff) == 0) uerror("getcwd", copy_string(buff));
|
||||
return copy_string(buff);
|
||||
}
|
||||
|
|
|
@ -19,9 +19,17 @@
|
|||
#include <sys/param.h>
|
||||
#include "unixsupport.h"
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#ifdef MAXPATHLEN
|
||||
#define PATH_MAN MAXPATHLEN
|
||||
#else
|
||||
#define PATH_MAX 512
|
||||
#endif
|
||||
#endif
|
||||
|
||||
value unix_readlink(value path) /* ML */
|
||||
{
|
||||
char buffer[MAXPATHLEN];
|
||||
char buffer[PATH_MAX];
|
||||
int len;
|
||||
len = readlink(String_val(path), buffer, sizeof(buffer) - 1);
|
||||
if (len == -1) uerror("readlink", path);
|
||||
|
|
Loading…
Reference in New Issue