| 1 |
Description: Patch for hurd-i386 compilationshort summary of the patch> |
| 2 |
Bug: 737308 |
| 3 |
Bug-Debian: https://bugs.debian.org/737308 |
| 4 |
Last-Update: 2019-04-15 |
| 5 |
|
| 6 |
--- rserve-1.7-3.1.orig/src/Rserv.c |
| 7 |
+++ rserve-1.7-3.1/src/Rserv.c |
| 8 |
@@ -2206,14 +2206,17 @@ static void rm_rf(const char *what) { |
| 9 |
chmod(what, st.st_mode | ((st.st_mode & S_IFDIR) ? S_IRWXU : S_IWUSR)); |
| 10 |
if (st.st_mode & S_IFDIR) { /* dirs need to be deleted recursively */ |
| 11 |
DIR *dir = opendir(what); |
| 12 |
|
| 13 |
+ char *path = NULL; |
| 14 |
if (dir) { |
| 15 |
struct dirent *d; |
| 16 |
while ((d = readdir(dir))) { |
| 17 |
if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, "..")) |
| 18 |
continue; |
| 19 |
|
| 20 |
+ int len = strlen(what) + 1 + strlen(d->d_name) + 1; |
| 21 |
+ path = (char*)malloc(len); |
| 22 |
+ snprintf(path, len, "%s/%s", what, d->d_name); |
| 23 |
rm_rf(path); |
| 24 |
+ free(path); |
| 25 |
} |
| 26 |
closedir(dir); |
| 27 |
} |