2011-05-17 16:59:23 +02:00
|
|
|
Index: lib/filesys.cpp
|
|
|
|
===================================================================
|
2012-02-02 21:59:26 +01:00
|
|
|
--- lib/filesys.cpp.orig
|
|
|
|
+++ lib/filesys.cpp
|
2013-10-28 11:17:07 +01:00
|
|
|
@@ -47,6 +47,7 @@
|
2011-05-17 16:59:23 +02:00
|
|
|
#include <sys/time.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <dirent.h>
|
|
|
|
+#include <climits>
|
|
|
|
|
2013-10-28 11:17:07 +01:00
|
|
|
#if HAVE_SYS_RESOURCE_H
|
2011-05-17 16:59:23 +02:00
|
|
|
#include <sys/resource.h>
|
2013-10-28 11:17:07 +01:00
|
|
|
@@ -412,7 +413,8 @@
|
2011-05-17 16:59:23 +02:00
|
|
|
} while (FindNextFileA(hFind, &findData));
|
|
|
|
::FindClose(hFind);
|
|
|
|
#else
|
2013-10-28 11:17:07 +01:00
|
|
|
- char filename[1024], subdir[1024];
|
2011-05-17 16:59:23 +02:00
|
|
|
+ char filename[PATH_MAX];
|
2013-10-28 11:17:07 +01:00
|
|
|
+ char *subdir;;
|
2011-05-17 16:59:23 +02:00
|
|
|
int retval=0;
|
|
|
|
DIRREF dirp;
|
|
|
|
double x;
|
2013-10-28 11:17:07 +01:00
|
|
|
@@ -423,7 +425,7 @@
|
2011-05-17 16:59:23 +02:00
|
|
|
while (1) {
|
|
|
|
retval = dir_scan(filename, dirp, sizeof(filename));
|
|
|
|
if (retval) break;
|
|
|
|
- sprintf(subdir, "%s/%s", dirpath, filename);
|
|
|
|
+ asprintf(&subdir, "%s/%s", dirpath, filename);
|
|
|
|
|
|
|
|
if (is_dir(subdir)) {
|
|
|
|
if (recurse) {
|
2013-10-28 11:17:07 +01:00
|
|
|
@@ -436,6 +438,9 @@
|
2011-05-17 16:59:23 +02:00
|
|
|
if (retval) continue;
|
|
|
|
size += x;
|
|
|
|
}
|
2013-10-28 11:17:07 +01:00
|
|
|
+
|
2011-05-17 16:59:23 +02:00
|
|
|
+ if(subdir != NULL)
|
|
|
|
+ free(subdir);
|
|
|
|
}
|
|
|
|
dir_close(dirp);
|
|
|
|
#endif
|