Source: rserve Version: 1.7-3-1 Severity: important Tags: patch User: debian-h...@lists.debian.org Usertags: hurd
Hi, rserve fails to build from source on GNU/Hurd since PATH_MAX is not defined. The following change solves this problem. src/Rserv.c: Use strlen() to find the string length needed (and allocating space for / and the terminating \0). A patch is attached. Thanks!
--- 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); }