MDEV-12778 mariadb-10.1 FTBFS on GNU/Hurd due to use of PATH_MAX
This commit is contained in:
parent
48429359d6
commit
ded614d7db
@ -197,7 +197,7 @@ int my_realpath(char *to, const char *filename, myf MyFlags)
|
|||||||
|
|
||||||
const char *my_open_parent_dir_nosymlinks(const char *pathname, int *pdfd)
|
const char *my_open_parent_dir_nosymlinks(const char *pathname, int *pdfd)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX+1];
|
char buf[FN_REFLEN + 1];
|
||||||
char *s= buf, *e= buf+1, *end= strnmov(buf, pathname, sizeof(buf));
|
char *s= buf, *e= buf+1, *end= strnmov(buf, pathname, sizeof(buf));
|
||||||
int fd, dfd= -1;
|
int fd, dfd= -1;
|
||||||
|
|
||||||
|
@ -107,12 +107,21 @@ const char *my_open_parent_dir_nosymlinks(const char *pathname, int *pdfd);
|
|||||||
res= AT; \
|
res= AT; \
|
||||||
if (dfd >= 0) close(dfd); \
|
if (dfd >= 0) close(dfd); \
|
||||||
return res;
|
return res;
|
||||||
#elif defined(HAVE_REALPATH)
|
#elif defined(HAVE_REALPATH) && defined(PATH_MAX)
|
||||||
#define NOSYMLINK_FUNCTION_BODY(AT,NOAT) \
|
#define NOSYMLINK_FUNCTION_BODY(AT,NOAT) \
|
||||||
char buf[PATH_MAX+1]; \
|
char buf[PATH_MAX+1]; \
|
||||||
if (realpath(pathname, buf) == NULL) return -1; \
|
if (realpath(pathname, buf) == NULL) return -1; \
|
||||||
if (strcmp(pathname, buf)) { errno= ENOTDIR; return -1; } \
|
if (strcmp(pathname, buf)) { errno= ENOTDIR; return -1; } \
|
||||||
return NOAT;
|
return NOAT;
|
||||||
|
#elif defined(HAVE_REALPATH)
|
||||||
|
#define NOSYMLINK_FUNCTION_BODY(AT,NOAT) \
|
||||||
|
char *buf= realpath(pathname, NULL); \
|
||||||
|
int res; \
|
||||||
|
if (buf == NULL) return -1; \
|
||||||
|
if (strcmp(pathname, buf)) { errno= ENOTDIR; res= -1; } \
|
||||||
|
else res= NOAT; \
|
||||||
|
free(buf); \
|
||||||
|
return res;
|
||||||
#else
|
#else
|
||||||
#define NOSYMLINK_FUNCTION_BODY(AT,NOAT) \
|
#define NOSYMLINK_FUNCTION_BODY(AT,NOAT) \
|
||||||
return NOAT;
|
return NOAT;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user