[distcc] patch: ignoring unresolvable host when constructing host
list
Yannick Brosseau
yannick.brosseau at usherbrooke.ca
Thu Apr 8 03:42:21 GMT 2004
Hi!
I've just tried distcc and the results are really awesome.
I'm sending a small patch which enhance the usabillity of distcc on my
laptop where I use it at home and in the lab. The patch add code to
check if a hostname can be resovlved before adding it to the hostlist.
With this patch, I can set all the name of the machine which I use, and,
since the name of my home machine and the ones in the lab are not the
same, only the locals hosts are added to the usable hosts list. Not
exactly the autodetect solution, but it solve the problem in my case.
Yannick :)
-------------
diff -rc distcc-2.13.orig/src/exitcode.h distcc-2.13/src/exitcode.h
*** distcc-2.13.orig/src/exitcode.h 2004-02-29 23:16:32.000000000 -0500
--- distcc-2.13/src/exitcode.h 2004-04-07 22:06:05.000000000 -0400
***************
*** 53,59 ****
EXIT_BUSY = 114, /**< In use by another
process. */
EXIT_NO_SUCH_FILE = 115,
EXIT_NO_HOSTS = 116,
! EXIT_GONE = 117 /**< No longer relevant */
};
--- 53,60 ----
EXIT_BUSY = 114, /**< In use by another
process. */
EXIT_NO_SUCH_FILE = 115,
EXIT_NO_HOSTS = 116,
! EXIT_GONE = 117, /**< No longer relevant */
! EXIT_HOSTNAME_NO_RESOLV = 118
};
diff -rc distcc-2.13.orig/src/hosts.c distcc-2.13/src/hosts.c
*** distcc-2.13.orig/src/hosts.c 2004-02-29 23:16:32.000000000 -0500
--- distcc-2.13/src/hosts.c 2004-04-07 22:34:51.000000000 -0400
***************
*** 89,94 ****
--- 89,97 ----
#include <errno.h>
#include <time.h>
#include <ctype.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netdb.h>
#include "distcc.h"
#include "trace.h"
***************
*** 303,309 ****
token = tail;
}
}
!
if ((ret = dcc_parse_multiplier(&token, hostdef)) != 0)
return ret;
--- 306,332 ----
token = tail;
}
}
!
! /* Check for hostname resolution */
! struct addrinfo hints;
! struct addrinfo *res;
! int error;
! char portname[20];
! snprintf(portname, sizeof portname, "%d", hostdef->port);
!
! /* set-up hints structure */
! memset(&hints, 0, sizeof(hints));
! hints.ai_family = PF_UNSPEC;
! hints.ai_socktype = SOCK_STREAM;
! error = getaddrinfo(hostdef->hostname, portname, &hints, &res);
! if (error) {
! rs_log_error("failed to resolve host %s port %d: %s",
! hostdef->hostname, hostdef->port,
! gai_strerror(error));
! return EXIT_HOSTNAME_NO_RESOLV;
! }
!
!
if ((ret = dcc_parse_multiplier(&token, hostdef)) != 0)
return ret;
***************
*** 428,435 ****
return ret;
} else {
rs_trace("found tcp token \"%.*s\"", token_len, token_start);
! if ((ret = dcc_parse_tcp_host(curr, token_start)) != 0)
! return ret;
}
/* continue to next token if any */
--- 451,465 ----
return ret;
} else {
rs_trace("found tcp token \"%.*s\"", token_len, token_start);
! if ((ret = dcc_parse_tcp_host(curr, token_start)) != 0) {
! if (EXIT_HOSTNAME_NO_RESOLV == ret) {
! /* continue to next token if any */
! where = token_start + token_len;
! continue;
! }
! else
! return ret;
! }
}
/* continue to next token if any */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : http://lists.samba.org/archive/distcc/attachments/20040407/d7f2c44d/signature.bin
More information about the distcc
mailing list