Blame SOURCES/0007-Issue-4973-update-snmp-to-use-run-dirsrv-for-PID-fil.patch

b2bc38
From c26c463ac92682dcf01ddbdc11cc1109b183eb0a Mon Sep 17 00:00:00 2001
b2bc38
From: Mark Reynolds <mreynolds@redhat.com>
b2bc38
Date: Mon, 1 Nov 2021 16:04:28 -0400
b2bc38
Subject: [PATCH 07/12] Issue 4973 - update snmp to use /run/dirsrv for PID
b2bc38
 file
b2bc38
b2bc38
Description:  Previously SNMP would write the agent PID file directly
b2bc38
              under /run (or /var/run), but this broke a CI test after
b2bc38
              updating lib389/defaults.inf to use /run/dirsrv.
b2bc38
b2bc38
              Instead of hacking the CI test, I changed the path
b2bc38
              snmp uses to:  /run/dirsrv/  Which is where it
b2bc38
              should really be written anyway.
b2bc38
b2bc38
relates: https://github.com/389ds/389-ds-base/issues/4973
b2bc38
b2bc38
Reviewed by: vashirov(Thanks!)
b2bc38
---
b2bc38
 ldap/servers/snmp/main.c         | 4 ++--
b2bc38
 wrappers/systemd-snmp.service.in | 6 +++---
b2bc38
 2 files changed, 5 insertions(+), 5 deletions(-)
b2bc38
b2bc38
diff --git a/ldap/servers/snmp/main.c b/ldap/servers/snmp/main.c
b2bc38
index e6271a8a9..d8eb918f6 100644
b2bc38
--- a/ldap/servers/snmp/main.c
b2bc38
+++ b/ldap/servers/snmp/main.c
b2bc38
@@ -287,14 +287,14 @@ load_config(char *conf_path)
b2bc38
     }
b2bc38
 
b2bc38
     /* set pidfile path */
b2bc38
-    if ((pidfile = malloc(strlen(LOCALRUNDIR) + strlen("/") +
b2bc38
+    if ((pidfile = malloc(strlen(LOCALRUNDIR) + strlen("/dirsrv/") +
b2bc38
                           strlen(LDAP_AGENT_PIDFILE) + 1)) != NULL) {
b2bc38
         strncpy(pidfile, LOCALRUNDIR, strlen(LOCALRUNDIR) + 1);
b2bc38
         /* The above will likely not be NULL terminated, but we need to
b2bc38
          * be sure that we're properly NULL terminated for the below
b2bc38
          * strcat() to work properly. */
b2bc38
         pidfile[strlen(LOCALRUNDIR)] = (char)0;
b2bc38
-        strcat(pidfile, "/");
b2bc38
+        strcat(pidfile, "/dirsrv/");
b2bc38
         strcat(pidfile, LDAP_AGENT_PIDFILE);
b2bc38
     } else {
b2bc38
         printf("ldap-agent: malloc error processing config file\n");
b2bc38
diff --git a/wrappers/systemd-snmp.service.in b/wrappers/systemd-snmp.service.in
b2bc38
index 477bc623d..f18766cb4 100644
b2bc38
--- a/wrappers/systemd-snmp.service.in
b2bc38
+++ b/wrappers/systemd-snmp.service.in
b2bc38
@@ -1,7 +1,7 @@
b2bc38
 # do not edit this file in /lib/systemd/system - instead do the following:
b2bc38
 # cp /lib/systemd/system/dirsrv-snmp.service /etc/systemd/system/
b2bc38
 # edit /etc/systemd/system/dirsrv-snmp.service
b2bc38
-# systemctl daemon-reload 
b2bc38
+# systemctl daemon-reload
b2bc38
 # systemctl (re)start dirsrv-snmp.service
b2bc38
 [Unit]
b2bc38
 Description=@capbrand@ Directory Server SNMP Subagent.
b2bc38
@@ -9,8 +9,8 @@ After=network.target
b2bc38
 
b2bc38
 [Service]
b2bc38
 Type=forking
b2bc38
-PIDFile=/run/ldap-agent.pid
b2bc38
-ExecStart=@sbindir@/ldap-agent @configdir@/ldap-agent.conf 
b2bc38
+PIDFile=/run/dirsrv/ldap-agent.pid
b2bc38
+ExecStart=@sbindir@/ldap-agent @configdir@/ldap-agent.conf
b2bc38
 
b2bc38
 [Install]
b2bc38
 WantedBy=multi-user.target
b2bc38
-- 
b2bc38
2.31.1
b2bc38