Re: rserve: FTBFS on hurd-i386 (for review)
Svante Signell, le Fri 31 Jan 2014 21:33:35 +0100, a écrit :
> new patch attached :)
That one seems right.
> --- a/src/Rserv.c.orig 2013-08-21 23:09:33.000000000 +0200
> +++ b/src/Rserv.c 2014-01-31 21:22:28.000000000 +0100
> @@ -2206,14 +2206,17 @@ static void rm_rf(const char *what) {
> chmod(what, st.st_mode | ((st.st_mode & S_IFDIR) ? S_IRWXU : S_IWUSR));
> if (st.st_mode & S_IFDIR) { /* dirs need to be deleted recursively */
> DIR *dir = opendir(what);
> - char path[PATH_MAX];
> + char *path = NULL;
> if (dir) {
> struct dirent *d;
> while ((d = readdir(dir))) {
> if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
> continue;
> - snprintf(path, sizeof(path), "%s/%s", what, d->d_name);
> + int len = strlen(what) + 1 + strlen(d->d_name) + 1;
> + path = (char*)malloc(len);
> + snprintf(path, len, "%s/%s", what, d->d_name);
> rm_rf(path);
> + free(path);
> }
> closedir(dir);
> }
--
Samuel
<erno> hm. I've lost a machine.. literally _lost_. it responds to ping, it works completely, I just can't figure out where in my apartment it is.
Reply to: