changeset 2953:3d8a77ba7ca6 draft

Use the exit code of EXIT_SUCCESS when terminating gracefully.
author Roy Marples <roy@marples.name>
date Wed, 18 Feb 2015 20:29:42 +0000
parents ac7eb3cb75ad
children 32b237987cef
files dhcpcd.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dhcpcd.c	Wed Feb 18 20:09:57 2015 +0000
+++ b/dhcpcd.c	Wed Feb 18 20:29:42 2015 +0000
@@ -1070,21 +1070,24 @@
 	struct dhcpcd_ctx *ctx;
 	struct dhcpcd_siginfo *si;
 	struct interface *ifp;
-	int do_release;
+	int do_release, exit_code;;
 
 	ctx = dhcpcd_ctx;
 	si = arg;
 	do_release = 0;
+	exit_code = EXIT_FAILURE;
 	switch (si->signo) {
 	case SIGINT:
 		syslog(LOG_INFO, sigmsg, "INT", (int)si->pid, "stopping");
 		break;
 	case SIGTERM:
 		syslog(LOG_INFO, sigmsg, "TERM", (int)si->pid, "stopping");
+		exit_code = EXIT_SUCCESS;
 		break;
 	case SIGALRM:
 		syslog(LOG_INFO, sigmsg, "ALRM", (int)si->pid, "releasing");
 		do_release = 1;
+		exit_code = EXIT_SUCCESS;
 		break;
 	case SIGHUP:
 		syslog(LOG_INFO, sigmsg, "HUP", (int)si->pid, "rebinding");
@@ -1113,7 +1116,7 @@
 
 	if (!(ctx->options & DHCPCD_TEST))
 		stop_all_interfaces(ctx, do_release);
-	eloop_exit(ctx->eloop, EXIT_FAILURE);
+	eloop_exit(ctx->eloop, exit_code);
 }
 
 static void