mirror of https://github.com/Icinga/icinga2.git
Added support for POSIX.1-2001 realpath() (Hello Solaris 10).
This commit is contained in:
parent
e14bf9faec
commit
0527ff012a
|
@ -326,7 +326,7 @@ string Application::GetExeDirectory(void) const
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
char Cwd[MAXPATHLEN];
|
char Cwd[MAXPATHLEN];
|
||||||
char *Buf, *PathEnv, *Directory, PathTest[MAXPATHLEN], FullExePath[MAXPATHLEN];
|
char *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();
|
||||||
|
@ -367,7 +367,8 @@ string Application::GetExeDirectory(void) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Buf = realpath(FullExePath, NULL)) == NULL)
|
char Buf[PATH_MAX];
|
||||||
|
if (realpath(FullExePath, Buf) == NULL)
|
||||||
throw PosixException("realpath failed", errno);
|
throw PosixException("realpath failed", errno);
|
||||||
|
|
||||||
// remove filename
|
// remove filename
|
||||||
|
@ -377,8 +378,6 @@ string Application::GetExeDirectory(void) const
|
||||||
*LastSlash = '\0';
|
*LastSlash = '\0';
|
||||||
|
|
||||||
ExePath = string(Buf);
|
ExePath = string(Buf);
|
||||||
|
|
||||||
free(Buf);
|
|
||||||
#else /* _WIN32 */
|
#else /* _WIN32 */
|
||||||
char FullExePath[MAXPATHLEN];
|
char FullExePath[MAXPATHLEN];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue