summaryrefslogtreecommitdiff
path: root/server/util
diff options
context:
space:
mode:
Diffstat (limited to 'server/util')
-rw-r--r--server/util/server.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/server/util/server.c b/server/util/server.c
index b2d6a3ce..a2402922 100644
--- a/server/util/server.c
+++ b/server/util/server.c
@@ -27,6 +27,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+#include <unistd.h>
#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;
+ }
}
}