Hello list,

attached patch fixes duplication of pid file declaration. I hope that the util/util.h is the right place for it. Another opinion are welcome.

Regards

--
Petr^4 Čech
>From 060116ea54ab4df0b6f012ac1c560ea0eeb53992 Mon Sep 17 00:00:00 2001
From: Petr Cech <[email protected]>
Date: Tue, 26 Jul 2016 15:51:55 +0200
Subject: [PATCH] UTILS: Fixing duplication of pid file declaration

Resolves:
https://fedorahosted.org/sssd/ticket/2978
---
 src/monitor/monitor.c          | 6 +-----
 src/tools/common/sss_process.c | 3 ---
 src/tools/tools_util.h         | 3 ---
 src/util/util.h                | 5 +++++
 4 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index 89dd0a91d1fbd41dd853cf8745de732b7059d02b..506636dc035fee9c3d3c4116b16b468a6d665797 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -72,10 +72,6 @@
  */
 #define MONITOR_MAX_RESTART_DELAY   4
 
-/* name of the monitor server instance */
-#define MONITOR_NAME        "sssd"
-#define SSSD_PIDFILE_PATH   PID_PATH"/"MONITOR_NAME".pid"
-
 /* Special value to leave the Kerberos Replay Cache set to use
  * the libkrb5 defaults
  */
@@ -1572,7 +1568,7 @@ static int monitor_cleanup(void)
     int ret;
 
     errno = 0;
-    ret = unlink(SSSD_PIDFILE_PATH);
+    ret = unlink(SSSD_PIDFILE);
     if (ret == -1) {
         ret = errno;
         DEBUG(SSSDBG_FATAL_FAILURE,
diff --git a/src/tools/common/sss_process.c b/src/tools/common/sss_process.c
index d4db4ab6f28fd154b928b77d0c05d4253b6cd9f3..6df260731362641a946f70627217fd5254039233 100644
--- a/src/tools/common/sss_process.c
+++ b/src/tools/common/sss_process.c
@@ -24,9 +24,6 @@
 #include "util/util.h"
 #include "tools/common/sss_process.h"
 
-#define SSSD_PIDFILE ""PID_PATH"/sssd.pid"
-#define MAX_PID_LENGTH 10
-
 static pid_t parse_pid(const char *strpid)
 {
     long value;
diff --git a/src/tools/tools_util.h b/src/tools/tools_util.h
index 93bc621fa2c98384b22ccd1066f02e9f4db10468..f31e843deb7122ee52664229b75eeb92878abe54 100644
--- a/src/tools/tools_util.h
+++ b/src/tools/tools_util.h
@@ -27,9 +27,6 @@
 
 #include "util/util.h"
 
-#define SSSD_PIDFILE ""PID_PATH"/sssd.pid"
-#define MAX_PID_LENGTH 10
-
 #define BAD_POPT_PARAMS(pc, msg, val, label) do { \
         usage(pc, msg);                           \
         val = EXIT_FAILURE;                       \
diff --git a/src/util/util.h b/src/util/util.h
index 122be90b967fb7793adaff95f3754d7a199fcf48..7a9e4cc91f5e0c18e6c5def453b786d3e907c421 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -53,6 +53,11 @@
 #include "util/sss_format.h"
 #include "util/debug.h"
 
+/* name of the monitor server instance */
+#define MONITOR_NAME        "sssd"
+#define SSSD_PIDFILE PID_PATH"/"MONITOR_NAME".pid"
+#define MAX_PID_LENGTH 10
+
 #define _(STRING) gettext (STRING)
 
 #define ENUM_INDICATOR "*"
-- 
2.7.4

_______________________________________________
sssd-devel mailing list
[email protected]
https://lists.fedorahosted.org/admin/lists/[email protected]

Reply via email to