forked from pool/boinc-client
5024a320b2
fix for bnc#689499 OBS-URL: https://build.opensuse.org/request/show/102548 OBS-URL: https://build.opensuse.org/package/show/network/boinc-client?expand=0&rev=17
42 lines
1.1 KiB
Diff
42 lines
1.1 KiB
Diff
Index: lib/filesys.cpp
|
|
===================================================================
|
|
--- lib/filesys.cpp.orig
|
|
+++ lib/filesys.cpp
|
|
@@ -36,6 +36,7 @@
|
|
#include <sys/time.h>
|
|
#include <unistd.h>
|
|
#include <dirent.h>
|
|
+#include <climits>
|
|
|
|
#ifdef HAVE_SYS_RESOURCE_H
|
|
#include <sys/resource.h>
|
|
@@ -371,7 +372,8 @@ int dir_size(const char* dirpath, double
|
|
} while (FindNextFileA(hFind, &findData));
|
|
::FindClose(hFind);
|
|
#else
|
|
- char filename[256], subdir[256];
|
|
+ char filename[PATH_MAX];
|
|
+ char *subdir;
|
|
int retval=0;
|
|
DIRREF dirp;
|
|
double x;
|
|
@@ -382,7 +384,7 @@ int dir_size(const char* dirpath, double
|
|
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) {
|
|
@@ -395,6 +397,9 @@ int dir_size(const char* dirpath, double
|
|
if (retval) continue;
|
|
size += x;
|
|
}
|
|
+
|
|
+ if(subdir != NULL)
|
|
+ free(subdir);
|
|
}
|
|
dir_close(dirp);
|
|
#endif
|