summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-05-16 03:55:19 +0200
committerLennart Poettering <lennart@poettering.net>2010-05-16 03:55:19 +0200
commitcb8a8f78a11cedb8cba1abfa9a63b0d3ea8eef93 (patch)
tree478197daa12a47d8be21d0fc458662ead9af2255 /util.c
parentca139f94c8de427616f54ab38262a47c4a636ffd (diff)
service: consider a process exiting with SIGTERM a clean exit
Diffstat (limited to 'util.c')
-rw-r--r--util.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/util.c b/util.c
index 95791f941d..5e3654d1d1 100644
--- a/util.c
+++ b/util.c
@@ -1910,6 +1910,23 @@ int make_stdio(int fd) {
return 0;
}
+bool is_clean_exit(int code, int status) {
+
+ if (code == CLD_EXITED)
+ return status == 0;
+
+ /* If a daemon does not implement handlers for some of the
+ * signals that's not considered an unclean shutdown */
+ if (code == CLD_KILLED)
+ return
+ status == SIGHUP ||
+ status == SIGINT ||
+ status == SIGTERM ||
+ status == SIGPIPE;
+
+ return false;
+}
+
static const char *const ioprio_class_table[] = {
[IOPRIO_CLASS_NONE] = "none",
[IOPRIO_CLASS_RT] = "realtime",