File 0093-Don-t-exit-0-if-killing-epmd-is-impossible-because-t.patch of Package erlang
From 161630f3e1e870dee50cd5c5161e9f09ebe9066b Mon Sep 17 00:00:00 2001
From: Stephan Renatus <srenatus@chef.io>
Date: Mon, 3 Apr 2017 11:15:39 +0200
Subject: [PATCH] Don't exit 0 if killing epmd is impossible because there's
living nodes
Living nodes will make `epmd -kill` fail, but there's no way to tell
except by looking at the commands output. With this change, the exit
code will be 1 to indicate failure.
Signed-off-by: Stephan Renatus <srenatus@chef.io>
---
erts/epmd/src/epmd_cli.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/erts/epmd/src/epmd_cli.c b/erts/epmd/src/epmd_cli.c
index 6fd27d46e..b10b331cb 100644
--- a/erts/epmd/src/epmd_cli.c
+++ b/erts/epmd/src/epmd_cli.c
@@ -46,10 +46,11 @@ void kill_epmd(EpmdVars *g)
if ((rval = read_fill(fd,buf,2)) == 2) {
if (buf[0] == 'O' && buf[1] == 'K') {
printf("Killed\n");
+ epmd_cleanup_exit(g,0);
} else {
printf("Killing not allowed - living nodes in database.\n");
+ epmd_cleanup_exit(g,1);
}
- epmd_cleanup_exit(g,0);
} else if (rval < 0) {
printf("epmd: failed to read answer from local epmd\n");
epmd_cleanup_exit(g,1);
--
2.12.2