From: Pavel Sanda Date: Sun, 19 Sep 2010 21:29:09 +0000 (+0000) Subject: PATH_MAX is not guaranteed by POSIX (fixes bug #6906). X-Git-Tag: 2.0.0~2546 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=1291b07c0578eb9017013c3e8b939b1887360a84;p=features.git PATH_MAX is not guaranteed by POSIX (fixes bug #6906). Patch from Samuel Thibault. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35452 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/support/os_unix.cpp b/src/support/os_unix.cpp index 337f728d5c..9663d98b64 100644 --- a/src/support/os_unix.cpp +++ b/src/support/os_unix.cpp @@ -297,9 +297,16 @@ bool autoOpenFile(string const & filename, auto_open_mode const mode) string real_path(string const & path) { +#ifdef __GLIBC__ + char * result = realpath(path.c_str(), NULL); + string ret = FileName::fromFilesystemEncoding(result ? result : path).absFileName(); + free(result); + return ret; +#else char rpath[PATH_MAX + 1]; char * result = realpath(path.c_str(), rpath); return FileName::fromFilesystemEncoding(result ? rpath : path).absFileName(); +#endif } } // namespace os