From b348e98e47d3ef287fed4d2e272bbf08540e0295 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Tue, 5 May 2009 13:36:17 +0200 Subject: Use tevent for shutdown signals, remove old pidfile, make sssd single-instance. Use tevent signal handling facilities for handlong SIGTERM and SIGINT in the monitor. Remove pidfile on SIGTERM and SIGINT. Make sssd single-instance by checking if we suceeded in signaling the process in the pidfile. --- server/util/server.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'server/util/server.c') diff --git a/server/util/server.c b/server/util/server.c index b2d6a3ce0..a24029229 100644 --- a/server/util/server.c +++ b/server/util/server.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "util/util.h" #include "ldb.h" #include "confdb/confdb.h" @@ -110,11 +111,18 @@ int pidfile(const char *path, const char *name) if (pid != 0) { errno = 0; ret = kill(pid, 0); - if (ret != 0 && errno != ESRCH) { + /* succeeded in signaling the process -> another sssd process */ + if (ret == 0) { close(fd); free(file); return EEXIST; } + if (ret != 0 && errno != ESRCH) { + err = errno; + close(fd); + free(file); + return err; + } } } -- cgit