diff options
author | Timothy Pearson <[email protected]> | 2011-07-23 17:13:36 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2011-07-23 17:13:36 -0500 |
commit | d3f7a9d6f1b8f6e24fb49aaa8caeaa7623ae48b5 (patch) | |
tree | baeeba639393f46abab749f4700a250091c3cc16 /tqtinterface/qt4/src/tools/tqfileinfo_unix.cpp | |
parent | d7be1694839bacae31e500ea9e36b3c13257ce28 (diff) | |
download | experimental-d3f7a9d6f1b8f6e24fb49aaa8caeaa7623ae48b5.tar.gz experimental-d3f7a9d6f1b8f6e24fb49aaa8caeaa7623ae48b5.zip |
Apply all Qt3.3.8d patches
NOTE: This will *likely* break compilation of TQt4
Please wait a few days for fixes to be committed as needed!
Diffstat (limited to 'tqtinterface/qt4/src/tools/tqfileinfo_unix.cpp')
-rw-r--r-- | tqtinterface/qt4/src/tools/tqfileinfo_unix.cpp | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/tqtinterface/qt4/src/tools/tqfileinfo_unix.cpp b/tqtinterface/qt4/src/tools/tqfileinfo_unix.cpp index 921b9f9..3be62bf 100644 --- a/tqtinterface/qt4/src/tools/tqfileinfo_unix.cpp +++ b/tqtinterface/qt4/src/tools/tqfileinfo_unix.cpp @@ -48,6 +48,9 @@ #if !defined(TQWS) && defined(TQ_OS_MAC) # include <tqt_mac.h> #endif +#if defined(Q_OS_HURD) +# include <stdlib.h> +#endif void TQFileInfo::slashify( TQString& ) { @@ -127,16 +130,43 @@ bool TQFileInfo::isSymLink() const TQString TQFileInfo::readLink() const { + if ( !isSymLink() ) + return TQString(); #if defined(TQ_OS_UNIX) && !defined(TQ_OS_OS2EMX) +#if defined(__GLIBC__) && !defined(PATH_MAX) + int size = 256; + char *s = NULL, *s2; + + while (1) + { + s2 = (char *) realloc (s, size); + if (s2 == NULL) { + free( s ); + return TQString(); + } + s = s2; + int len = readlink ( TQFile::encodeName(fn).data(), s, size ); + if ( len < 0 ) { + free( s ); + return TQString(); + } + if ( len < size ) { + s[len] = '\0'; + TQString str = TQFile::decodeName(s); + free(s); + return str; + } + size *= 2; + } +#else char s[PATH_MAX+1]; - if ( !isSymLink() ) - return TQString(); int len = readlink( TQFile::encodeName(fn).data(), s, PATH_MAX ); if ( len >= 0 ) { s[len] = '\0'; return TQFile::decodeName(s); } -#endif +#endif /* __GLIBC__ && !PATH_MAX */ +#endif /* Q_OS_UNIX && !Q_OS_OS2EMX */ #if !defined(TQWS) && defined(TQ_OS_MAC) { FSRef fref; |