pkgsrc/x11/kdelibs3/patches/patch-cg
2005-01-05 10:27:43 +00:00

42 lines
1.2 KiB
Text

$NetBSD: patch-cg,v 1.2 2005/01/05 10:27:43 markd Exp $
--- kio/kio/kurlcompletion.cpp.orig 2004-06-23 05:36:41.000000000 +1200
+++ kio/kio/kurlcompletion.cpp
@@ -54,6 +54,7 @@
#include <sys/stat.h>
#include <pwd.h>
#include <time.h>
+#include <sys/param.h>
#include "kurlcompletion.h"
@@ -218,11 +219,18 @@ void DirectoryListThread::run()
QDir::setCurrent( *it );
// Loop through all directory entries
+ // Solaris and IRIX dirent structures do not allocate space for d_name. On
+ // systems that do (HP-UX, Linux, Tru64 UNIX), we overallocate space but
+ // that's ok.
- struct dirent dirPosition;
+ struct dirent *dirPosition = (struct dirent *) malloc( sizeof( struct dirent ) + MAXPATHLEN + 1 );
struct dirent *dirEntry = 0;
while ( !terminationRequested() &&
- ::readdir_r( dir, &dirPosition, &dirEntry ) == 0 && dirEntry )
+#if defined(__NetBSD__) && __NetBSD_Version__ < 106210000 /* NetBSD 1.6U */
+ (dirEntry = ::readdir( dir )))
+#else
+ ::readdir_r( dir, dirPosition, &dirEntry ) == 0 && dirEntry )
+#endif
{
// Skip hidden files if m_noHidden is true
@@ -280,6 +288,8 @@ void DirectoryListThread::run()
::closedir( dir );
dir = 0;
+
+ free( dirPosition );
}
done();