summaryrefslogtreecommitdiff
path: root/x11/kdelibs3/patches/patch-cg
blob: 21efc8832b79d25ef08ad7f01b866663046dba9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
$NetBSD: patch-cg,v 1.1.4.1 2005/01/06 00:19:42 salo 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();