Package: analog
Severity: normal
Tags: upstream patch
Dear Maintainer,
analog currently fails to build on hurd-i386 because it uses the PATH_MAX
macro. The attached patch should fix the issue: it changes calls to realpath()
so that the second argument is NULL, which forces realpath() to allocate
memory, thus removing the need for the application to allocate a buffer of size
PATH_MAX+1.
WBR,
Cyril Roelandt.
-- System Information:
Debian Release: wheezy/sid
APT prefers unreleased
APT policy: (500, 'unreleased'), (500, 'unstable')
Architecture: hurd-i386 (i686-AT386)
Kernel: GNU-Mach 1.3.99/Hurd-0.3
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
--- analog-6.0.orig/src/globals.c 2004-12-19 13:51:30.000000000 +0000
+++ analog-6.0/src/globals.c 2012-05-28 00:40:51.000000000 +0000
@@ -1266,7 +1266,6 @@
else
COPYSTR(commandname, comname);
#ifndef NOFOLLOW
- commandpath = (char *)xmalloc(PATH_MAX);
done = FALSE;
if (strpbrk(commandname, PATHSEPS) == NULL &&
(path = getenv("PATH")) != NULL) {
@@ -1275,12 +1274,12 @@
for (s = strtok(pathcp, ":"); !done && s != NULL; s = strtok(NULL, ":")) {
ENSURE_LEN(t, l, strlen(s) + strlen(commandname) + 2);
sprintf(t, "%s%c%s", s, DIRSEP, commandname);
- if (realpath(t, commandpath) != NULL && access(commandpath, X_OK) == 0 &&
+ if ((commandpath = realpath(t, NULL)) != NULL && access(commandpath, X_OK) == 0 &&
stat(commandpath, &buf) == 0 && S_ISREG(buf.st_mode))
done = TRUE;
}
}
- else if (realpath(commandname, commandpath) != NULL)
+ else if ((commandpath = realpath(commandname, NULL)) != NULL)
done = TRUE;
if (!done)
strcpy(commandpath, commandname);