]> git.pld-linux.org Git - packages/distcc.git/blame - distcc-hostfile.patch
- dropped (by misi3k)
[packages/distcc.git] / distcc-hostfile.patch
CommitLineData
2f4e2bef 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
3@@ -72,6 +72,9 @@
4 #include <errno.h>
5 #include <time.h>
6 #include <ctype.h>
7+#include <sys/types.h>
8+#include <sys/stat.h>
9+#include <fcntl.h>
10
11 #include "distcc.h"
12 #include "trace.h"
13@@ -107,9 +110,45 @@
14 char *where;
15
16 where = getenv("DISTCC_HOSTS");
17- if (!where) {
18- rs_log_warning("$DISTCC_HOSTS is not defined; can't distribute work");
19- return EXIT_BAD_HOSTSPEC;
20+ if (!where) {
21+ char *filename;
22+ int file;
23+ char buffer[4096];
24+ int readcount;
25+ char *listbuf=0;
26+ int listbufsize=4096;
27+ int listbuflen=0;
28+ int parseresult;
29+
30+ listbuf = malloc(4096);
31+
32+ filename = getenv("DISTCC_HOSTS_FILE");
33+ if (!filename)
34+ {
35+ rs_log_warning("$DISTCC_HOSTS or $DISTCC_HOSTS_FILE not defined;"
36+ " can't distribute work");
37+ return 1;
38+ }
39+ file = open(filename, O_RDONLY);
40+
41+ while ((readcount = read(file, buffer, 4096)) > 0)
42+ {
43+ if (readcount+listbuflen > listbufsize)
44+ {
45+ char *temp;
46+ temp = malloc(readcount+listbuflen);
47+ memcpy(temp, listbuf, listbuflen);
48+ free(listbuf);
49+ listbuf = temp;
50+ listbufsize = readcount+listbuflen;
51+ }
52+ memcpy(listbuf+listbuflen, buffer, readcount);
53+ }
54+ close(file);
55+ /* ok, I've read the file, now have it parsed */
56+ parseresult = dcc_parse_hosts(listbuf, ret_list, ret_nhosts);
57+ free(listbuf);
58+ return parseresult;
59 }
60
61 return dcc_parse_hosts(where, ret_list, ret_nhosts);
62@@ -296,7 +335,7 @@
63 if (*ret_nhosts) {
64 return 0;
65 } else {
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;
69 }
70 }
This page took 0.100444 seconds and 4 git commands to generate.