From 16642157bebd6c691207dd0e4ed5f1a2830bd316 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Sat, 7 Jun 2014 06:55:47 +0200 Subject: fix error handling in case execlp() fails --- dyndhcpd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dyndhcpd.c b/dyndhcpd.c index dde769b..1794831 100644 --- a/dyndhcpd.c +++ b/dyndhcpd.c @@ -274,10 +274,11 @@ int main(int argc, char ** argv) { if (verbose > 1) printf("Running: dhcpd -f -d -q -4 -pf %s -lf %s -cf %s %s\n", pidfile, leasesfile, filename, interface); - execlp(DHCPDFILE, "dhcpd", "-f", "-d", "-q", "-4", + rc = execlp(DHCPDFILE, "dhcpd", "-f", "-d", "-q", "-4", "-pf", pidfile, "-lf", leasesfile, "-cf", filename, interface, NULL); - rc = EXIT_SUCCESS; + fprintf(stderr, "The dhcp daemon failed to execute.\n"); + goto out; } else { /* failed to convert addresses from binary to string */ -- cgit v1.2.3-70-g09d2