[distcc] Improve one error report
Wayne Davison
wayned at users.sourceforge.net
Wed May 21 22:02:29 GMT 2003
I noticed that if the user has an empty ~/.distcc/hosts file that the
error message complained about $DISTCC_HOSTS. The attached patch
changes this to complain about the actual item being parsed.
..wayne..
-------------- next part --------------
Index: src/distcc.h
--- src/distcc.h 5 May 2003 08:40:25 -0000 1.96
+++ src/distcc.h 21 May 2003 21:56:28 -0000
@@ -125,7 +125,7 @@
/* hosts.c */
int dcc_parse_hosts_env(struct dcc_hostdef **ret_list,
int *ret_nhosts);
-int dcc_parse_hosts(const char *where,
+int dcc_parse_hosts(const char *where, const char *source_name,
struct dcc_hostdef **ret_list,
int *ret_nhosts);
Index: src/hostfile.c
--- src/hostfile.c 7 May 2003 01:50:45 -0000 1.4
+++ src/hostfile.c 21 May 2003 21:56:28 -0000
@@ -60,7 +60,7 @@
if ((ret = dcc_load_file(fname, &body)) != 0)
return ret;
- ret = dcc_parse_hosts(body, ret_list, ret_nhosts);
+ ret = dcc_parse_hosts(body, fname, ret_list, ret_nhosts);
free(body);
Index: src/hosts.c
--- src/hosts.c 21 May 2003 05:54:52 -0000 1.40
+++ src/hosts.c 21 May 2003 21:56:28 -0000
@@ -115,7 +115,7 @@
if ((env = getenv("DISTCC_HOSTS")) != NULL) {
rs_trace("read hosts from environment");
- return dcc_parse_hosts(env, ret_list, ret_nhosts);
+ return dcc_parse_hosts(env, "$DISTCC_HOSTS", ret_list, ret_nhosts);
}
/* ~/.distcc/hosts */
@@ -266,7 +266,7 @@
* @return 0 if parsed successfully; nonzero if there were any errors,
* or if no hosts were defined.
**/
-int dcc_parse_hosts(const char *where,
+int dcc_parse_hosts(const char *where, const char *source_name,
struct dcc_hostdef **ret_list,
int *ret_nhosts)
{
@@ -349,7 +349,7 @@
if (*ret_nhosts) {
return 0;
} else {
- rs_log_warning("$DISTCC_HOSTS is empty; can't distribute work");
+ rs_log_warning("%s contained no hosts; can't distribute work", source_name);
return EXIT_BAD_HOSTSPEC;
}
}
More information about the distcc
mailing list