]> git.pld-linux.org Git - packages/distcc.git/commitdiff
hostfile patch, takes hosts from a file
authormisi3k <misi3k@pld-linux.org>
Mon, 31 Mar 2003 20:08:37 +0000 (20:08 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    distcc-hostfile.patch -> 1.1

distcc-hostfile.patch [new file with mode: 0644]

diff --git a/distcc-hostfile.patch b/distcc-hostfile.patch
new file mode 100644 (file)
index 0000000..3f310a3
--- /dev/null
@@ -0,0 +1,70 @@
+--- distcc-2.0.1/src/hosts.c.old Wed Oct  9 08:58:04 2002
++++ distcc-2.0.1/src/hosts.c     Wed Oct  9 09:16:14 2002
+@@ -72,6 +72,9 @@
+ #include <errno.h>
+ #include <time.h>
+ #include <ctype.h>
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <fcntl.h>
+ #include "distcc.h"
+ #include "trace.h"
+@@ -107,9 +110,45 @@
+     char *where;
+     where = getenv("DISTCC_HOSTS");
+-    if (!where) {
+-        rs_log_warning("$DISTCC_HOSTS is not defined; can't distribute work");
+-        return EXIT_BAD_HOSTSPEC;
++       if (!where) {
++        char *filename;
++        int file;
++        char buffer[4096];
++        int readcount;
++        char *listbuf=0;
++        int listbufsize=4096;
++        int listbuflen=0;
++        int parseresult;
++        
++        listbuf = malloc(4096);
++        
++        filename = getenv("DISTCC_HOSTS_FILE");
++        if (!filename)
++        {
++            rs_log_warning("$DISTCC_HOSTS or $DISTCC_HOSTS_FILE not defined;"
++                           " can't distribute work");
++            return 1;
++        }
++        file = open(filename, O_RDONLY);
++
++        while ((readcount = read(file, buffer, 4096)) > 0)
++        {
++            if (readcount+listbuflen > listbufsize)
++            {
++                char *temp;
++                temp = malloc(readcount+listbuflen);
++                memcpy(temp, listbuf, listbuflen);
++                free(listbuf);
++                listbuf = temp;
++                listbufsize = readcount+listbuflen;
++            }
++            memcpy(listbuf+listbuflen, buffer, readcount);
++        }
++        close(file);
++        /* ok, I've read the file, now have it parsed */
++        parseresult = dcc_parse_hosts(listbuf, ret_list, ret_nhosts);
++        free(listbuf);
++        return parseresult;
+     }
+     return dcc_parse_hosts(where, ret_list, ret_nhosts);
+@@ -296,7 +335,7 @@
+     if (*ret_nhosts) {
+         return 0;
+     } else {
+-        rs_log_warning("$DISTCC_HOSTS is empty; can't distribute work"); 
++        rs_log_warning("$DISTCC_HOSTS or $DISTCC_HOSTS_FILE is empty; can't distribute work"); 
+         return EXIT_BAD_HOSTSPEC;
+     }
+ }
This page took 0.105554 seconds and 4 git commands to generate.