mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-28 16:14:09 +02:00
Fixed PATH_MAX problems on *NIX.
This commit is contained in:
parent
f890f1d42c
commit
24c0c7cb9c
@ -274,8 +274,8 @@ string Application::GetExeDirectory(void)
|
|||||||
return ExePath;
|
return ExePath;
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
char Buf[MAXPATHLEN], Cwd[MAXPATHLEN];
|
char Cwd[MAXPATHLEN];
|
||||||
char *PathEnv, *Directory, PathTest[MAXPATHLEN], FullExePath[MAXPATHLEN];
|
char *Buf, *PathEnv, *Directory, PathTest[MAXPATHLEN], FullExePath[MAXPATHLEN];
|
||||||
bool FoundPath;
|
bool FoundPath;
|
||||||
|
|
||||||
const char *argv0 = m_Arguments[0].c_str();
|
const char *argv0 = m_Arguments[0].c_str();
|
||||||
@ -319,7 +319,7 @@ string Application::GetExeDirectory(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (realpath(FullExePath, Buf) == NULL)
|
if ((Buf = realpath(FullExePath, NULL)) == NULL)
|
||||||
throw exception(/*"realpath() failed"*/);
|
throw exception(/*"realpath() failed"*/);
|
||||||
|
|
||||||
// remove filename
|
// remove filename
|
||||||
@ -329,6 +329,8 @@ string Application::GetExeDirectory(void)
|
|||||||
*LastSlash = '\0';
|
*LastSlash = '\0';
|
||||||
|
|
||||||
ExePath = string(Buf);
|
ExePath = string(Buf);
|
||||||
|
|
||||||
|
free(Buf);
|
||||||
#else /* _WIN32 */
|
#else /* _WIN32 */
|
||||||
char FullExePath[MAXPATHLEN];
|
char FullExePath[MAXPATHLEN];
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef UNIX_H
|
#ifndef UNIX_H
|
||||||
#define UNIX_H
|
#define UNIX_H
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -19,10 +20,6 @@ void closesocket(SOCKET fd);
|
|||||||
|
|
||||||
#define ioctlsocket ioctl
|
#define ioctlsocket ioctl
|
||||||
|
|
||||||
#ifndef PATH_MAX
|
|
||||||
# define PATH_MAX 1024
|
|
||||||
#endif /* PATH_MAX */
|
|
||||||
|
|
||||||
#define MAXPATHLEN PATH_MAX
|
#define MAXPATHLEN PATH_MAX
|
||||||
|
|
||||||
/* default visibility takes care of exported symbols */
|
/* default visibility takes care of exported symbols */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user