diff options
Diffstat (limited to 'net-misc/dhcp/files/dhcp-3.0.4-dhclient-stdin-conf.patch')
-rw-r--r-- | net-misc/dhcp/files/dhcp-3.0.4-dhclient-stdin-conf.patch | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/net-misc/dhcp/files/dhcp-3.0.4-dhclient-stdin-conf.patch b/net-misc/dhcp/files/dhcp-3.0.4-dhclient-stdin-conf.patch new file mode 100644 index 000000000..3fedc7c0e --- /dev/null +++ b/net-misc/dhcp/files/dhcp-3.0.4-dhclient-stdin-conf.patch @@ -0,0 +1,83 @@ +--- common/conflex.c.orig 2006-02-21 16:21:45.000000000 +0000 ++++ common/conflex.c 2006-02-21 16:23:06.000000000 +0000 +@@ -90,7 +90,7 @@ + struct parse **cfile; + { + /* "Memory" config files have no file. */ +- if ((*cfile)->file != -1) ++ if ((*cfile)->file != -1 && (*cfile)->file != fileno(stdin)) + close((*cfile)->file); + + if ((*cfile)->bufsiz) +--- client/clparse.c.orig 2006-02-22 09:37:12.000000000 +0000 ++++ client/clparse.c 2006-02-22 09:38:26.000000000 +0000 +@@ -97,6 +97,11 @@ + status = read_client_conf_file (path_dhclient_conf, + (struct interface_info *)0, + &top_level_config); ++ ++ /* Read any extra configuration from stdin */ ++ read_client_conf_stdin ((struct interface_info *)0, ++ &top_level_config); ++ + if (status != ISC_R_SUCCESS) { + ; + #ifdef LATER +@@ -148,20 +153,17 @@ + return status; + } + +-int read_client_conf_file (const char *name, struct interface_info *ip, +- struct client_config *client) ++int read_client_conf_actual (int file, const char *name, ++ struct interface_info *ip, ++ struct client_config *client) + { +- int file; + struct parse *cfile; + const char *val; + int token; + isc_result_t status; + +- if ((file = open (name, O_RDONLY)) < 0) +- return uerr2isc (errno); +- + cfile = (struct parse *)0; +- new_parse (&cfile, file, (char *)0, 0, path_dhclient_conf, 0); ++ new_parse (&cfile, file, (char *)0, 0, name , 0); + + do { + token = peek_token (&val, (unsigned *)0, cfile); +@@ -177,6 +179,32 @@ + return status; + } + ++int read_client_conf_file (const char *name, struct interface_info *ip, ++ struct client_config *client) ++{ ++ int file; ++ isc_result_t status; ++ ++ if ((file = open (name, O_RDONLY)) < 0) ++ return uerr2isc (errno); ++ ++ status = read_client_conf_actual(file, name, ip, client); ++ ++ return status; ++} ++ ++ ++int read_client_conf_stdin (struct interface_info *ip, ++ struct client_config *client) ++{ ++ int file = fileno(stdin); ++ isc_result_t status; ++ ++ if (isatty(file)) return ISC_R_NOTFOUND; ++ status = read_client_conf_actual(file, "stdin", ip, client); ++ ++ return status; ++} + + /* lease-file :== client-lease-statements END_OF_FILE + client-lease-statements :== <nil> |