dhcp/dhcp-4.2.4-P1-dhclient6-leases_semicolon_expected.patch

42 lines
1.6 KiB
Diff
Raw Normal View History

diff -up dhcp-4.2.4-P1/client/dhclient.c.dhclient6-leases_semicolon dhcp-4.2.4-P1/client/dhclient.c
--- dhcp-4.2.4-P1/client/dhclient.c.dhclient6-leases_semicolon 2012-07-25 15:20:22.187164614 +0200
+++ dhcp-4.2.4-P1/client/dhclient.c 2012-07-25 15:20:26.648152028 +0200
@@ -3236,10 +3236,21 @@ void write_lease_option (struct option_c
}
if (evaluate_option_cache (&ds, packet, lease, client_state,
in_options, cfg_options, scope, oc, MDL)) {
- fprintf(leaseFile, "%soption %s%s%s %s;\n", preamble,
- name, dot, oc->option->name,
- pretty_print_option(oc->option, ds.data, ds.len,
- 1, 1));
+ /* The option name */
+ fprintf(leaseFile, "%soption %s%s%s", preamble,
+ name, dot, oc->option->name);
+
+ /* The option value if there is one */
+ if ((oc->option->format == NULL) ||
+ (oc->option->format[0] != 'Z')) {
+ fprintf(leaseFile, " %s",
+ pretty_print_option(oc->option, ds.data,
+ ds.len, 1, 1));
+ }
+
+ /* The closing semi-colon and newline */
+ fprintf(leaseFile, ";\n");
+
data_string_forget (&ds, MDL);
}
}
diff -up dhcp-4.2.4-P1/common/parse.c.dhclient6-leases_semicolon dhcp-4.2.4-P1/common/parse.c
--- dhcp-4.2.4-P1/common/parse.c.dhclient6-leases_semicolon 2012-07-25 15:10:39.683557386 +0200
+++ dhcp-4.2.4-P1/common/parse.c 2012-07-25 15:16:50.826762985 +0200
@@ -5772,7 +5772,7 @@ int parse_option_decl (oc, cfile)
goto alloc;
case 'Z': /* Zero-length option */
- token = next_token(&val, (unsigned *)0, cfile);
+ token = peek_token(&val, (unsigned *)0, cfile);
if (token != SEMI) {
parse_warn(cfile,
"semicolon expected.");