1 --- distcc-2.0.1/src/hosts.c.old Wed Oct 9 08:58:04 2002
2 +++ distcc-2.0.1/src/hosts.c Wed Oct 9 09:16:14 2002
7 +#include <sys/types.h>
16 where = getenv("DISTCC_HOSTS");
18 - rs_log_warning("$DISTCC_HOSTS is not defined; can't distribute work");
19 - return EXIT_BAD_HOSTSPEC;
26 + int listbufsize=4096;
30 + listbuf = malloc(4096);
32 + filename = getenv("DISTCC_HOSTS_FILE");
35 + rs_log_warning("$DISTCC_HOSTS or $DISTCC_HOSTS_FILE not defined;"
36 + " can't distribute work");
39 + file = open(filename, O_RDONLY);
41 + while ((readcount = read(file, buffer, 4096)) > 0)
43 + if (readcount+listbuflen > listbufsize)
46 + temp = malloc(readcount+listbuflen);
47 + memcpy(temp, listbuf, listbuflen);
50 + listbufsize = readcount+listbuflen;
52 + memcpy(listbuf+listbuflen, buffer, readcount);
55 + /* ok, I've read the file, now have it parsed */
56 + parseresult = dcc_parse_hosts(listbuf, ret_list, ret_nhosts);
61 return dcc_parse_hosts(where, ret_list, ret_nhosts);
66 - rs_log_warning("$DISTCC_HOSTS is empty; can't distribute work");
67 + rs_log_warning("$DISTCC_HOSTS or $DISTCC_HOSTS_FILE is empty; can't distribute work");
68 return EXIT_BAD_HOSTSPEC;