Running dhpcd --dumplease with input from stdin and redirecting stdout
to a file outputs nothing to the output. The reason is that printf /
fprintf is used to write the output but it is not explicitly flushed
when done, or before exiting, and stdout to files is fully buffered by
default while stdout to terminals is line buffered by default.
This adds calls to fflush() at the end of dhcp_print_option_encoding()
and script_dump(), plus one just before exiting dhcpcd.
Signed-off-by: Diego Santa Cruz <diego.santacruz@spinetix.com>
if (opt->type & OT_NOREQ)
printf(" norequest");
putchar('\n');
+ fflush(stdout);
}
struct dhcp_opt *
eloop_free(ctx.eloop);
logclose();
free(ctx.logfile);
+ fflush(stdout);
free(ctx.ctl_buf);
#ifdef SETPROCTITLE_H
setproctitle_fini();
env += 4;
printf("%s\n", env);
}
+ fflush(stdout);
return 0;
}