diff options
author | fergus.henderson@gmail.com <fergus.henderson@gmail.com@01de4be4-8c4a-0410-9132-4925637da917> | 2012-04-10 17:22:14 +0000 |
---|---|---|
committer | fergus.henderson@gmail.com <fergus.henderson@gmail.com@01de4be4-8c4a-0410-9132-4925637da917> | 2012-04-10 17:22:14 +0000 |
commit | 2f422c03925e82bf88b05da823813073a985b0e5 (patch) | |
tree | 69876c1ec3e80f4e2f11d98cad25fee7ed483342 | |
parent | b01ee33071f0ec0d1bc3fbfc71d8d46feac3df02 (diff) | |
download | distcc-2f422c03925e82bf88b05da823813073a985b0e5.tar.gz |
Apply patch from Jérémie Koenig <jk@jk.fr.eu.org>:
Fix for <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=638258>:
Distcc fails to build on hurd-i386 because it relies on PATH_MAX being
defined.
git-svn-id: http://distcc.googlecode.com/svn/trunk@765 01de4be4-8c4a-0410-9132-4925637da917
-rw-r--r-- | src/stringmap.c | 4 | ||||
-rw-r--r-- | src/zeroconf.c | 13 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/stringmap.c b/src/stringmap.c index 8bf2eab..2fa2a59 100644 --- a/src/stringmap.c +++ b/src/stringmap.c @@ -32,6 +32,10 @@ #define NULL 0 #endif +#ifndef PATH_MAX +#define PATH_MAX 4096 +#endif + /* Load the given list of strings into the key/value map. * The key for each string is the numFinalWordsToMatch of the string; * the value for each string is the entire string. diff --git a/src/zeroconf.c b/src/zeroconf.c index 5b70566..652cc1d 100644 --- a/src/zeroconf.c +++ b/src/zeroconf.c @@ -540,7 +540,7 @@ static int get_zeroconf_dir(char **dir_ret) { /* Get the host list from zeroconf */ int dcc_zeroconf_add_hosts(struct dcc_hostdef **ret_list, int *ret_nhosts, int n_slots, struct dcc_hostdef **ret_prev) { - char host_file[PATH_MAX], lock_file[PATH_MAX], *s = NULL; + char *host_file = NULL, *lock_file = NULL, *s = NULL; int lock_fd = -1, host_fd = -1; int fork_daemon = 0; int r = -1; @@ -552,8 +552,13 @@ int dcc_zeroconf_add_hosts(struct dcc_hostdef **ret_list, int *ret_nhosts, int n goto finish; } - snprintf(lock_file, sizeof(lock_file), "%s/lock", dir); - snprintf(host_file, sizeof(host_file), "%s/hosts", dir); + lock_file = malloc(strlen(dir) + sizeof("/lock")); + assert(lock_file); + sprintf(lock_file, "%s/lock", dir); + + host_file = malloc(strlen(dir) + sizeof("/hosts")); + assert(host_file); + sprintf(host_file, "%s/hosts", dir); /* Open lock file */ if ((lock_fd = open(lock_file, O_RDWR|O_CREAT, 0666)) < 0) { @@ -659,6 +664,8 @@ finish: close(host_fd); } + free(lock_file); + free(host_file); free(s); return r; |