|
|
cd5d626 |
From bbcf9eedb2299ab55a0ae208e196eb2ca59ad97e Mon Sep 17 00:00:00 2001
|
|
|
cd5d626 |
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
|
|
cd5d626 |
Date: Thu, 30 May 2019 13:20:25 +0200
|
|
|
cd5d626 |
Subject: [PATCH] Make a directory for quota_nld PID file configurable
|
|
|
cd5d626 |
MIME-Version: 1.0
|
|
|
cd5d626 |
Content-Type: text/plain; charset=UTF-8
|
|
|
cd5d626 |
Content-Transfer-Encoding: 8bit
|
|
|
cd5d626 |
|
|
|
cd5d626 |
While Filesystem Hierarchy Standard prescribes /var/run path for
|
|
|
cd5d626 |
storing PID files, some (systemd-based) distributions uses /run.
|
|
|
cd5d626 |
|
|
|
cd5d626 |
This patch adds a --with-pid-dir=DIRECTORY option to the ./configure
|
|
|
cd5d626 |
script. The option enables to change the path. Default one is
|
|
|
cd5d626 |
/var/run as used to be until now.
|
|
|
cd5d626 |
|
|
|
cd5d626 |
(I did not use $localstatedir environment variable because Autoconf
|
|
|
cd5d626 |
manual allows using "precious" variables only in a makefile.)
|
|
|
cd5d626 |
|
|
|
cd5d626 |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
cd5d626 |
---
|
|
|
cd5d626 |
configure.ac | 10 ++++++++++
|
|
|
cd5d626 |
quota_nld.c | 4 ++--
|
|
|
cd5d626 |
2 files changed, 12 insertions(+), 2 deletions(-)
|
|
|
cd5d626 |
|
|
|
cd5d626 |
diff --git a/configure.ac b/configure.ac
|
|
|
cd5d626 |
index b783568..3cb57c5 100644
|
|
|
cd5d626 |
--- a/configure.ac
|
|
|
cd5d626 |
+++ b/configure.ac
|
|
|
cd5d626 |
@@ -277,6 +277,15 @@ AS_IF([test "$with_proc_mounts" != "no"], [
|
|
|
cd5d626 |
AC_DEFINE_UNQUOTED([ALT_MTAB], ["$with_proc_mounts"], [File with mounted filesystems])
|
|
|
cd5d626 |
])
|
|
|
cd5d626 |
|
|
|
cd5d626 |
+AC_ARG_WITH([pid-dir],
|
|
|
cd5d626 |
+ [AS_HELP_STRING([--with-pid-dir=DIRECTORY], [Create PID files in this directory instead of /var/run])],
|
|
|
cd5d626 |
+ [with_pid_dir="$withval"]
|
|
|
cd5d626 |
+)
|
|
|
cd5d626 |
+AS_IF([test "X$with_pid_dir" == "X" -o "$with_pid_dir" == "yes" -o "$with_pid_dir" == "no"],[
|
|
|
cd5d626 |
+ with_pid_dir="/var/run"
|
|
|
cd5d626 |
+])
|
|
|
cd5d626 |
+AC_DEFINE_UNQUOTED([PID_DIR], ["$with_pid_dir"], [Directory for PID files])
|
|
|
cd5d626 |
+
|
|
|
cd5d626 |
AC_DEFINE_UNQUOTED([COMPILE_OPTS], ["$COMPILE_OPTS"], [Configuration options])
|
|
|
cd5d626 |
|
|
|
cd5d626 |
AC_CONFIG_FILES([
|
|
|
cd5d626 |
@@ -297,6 +306,7 @@ Build configuration:
|
|
|
cd5d626 |
libwrap: ${build_libwrap}
|
|
|
cd5d626 |
netlink: ${build_netlink}
|
|
|
cd5d626 |
nls: ${enable_nls}
|
|
|
cd5d626 |
+ pid-dir: ${with_pid_dir}
|
|
|
cd5d626 |
proc-mounts: ${with_proc_mounts}
|
|
|
cd5d626 |
rpc: ${build_rpc}
|
|
|
cd5d626 |
rpcsetquota: ${enable_rpcsetquota}
|
|
|
cd5d626 |
diff --git a/quota_nld.c b/quota_nld.c
|
|
|
cd5d626 |
index ac24bdb..72d99a9 100644
|
|
|
cd5d626 |
--- a/quota_nld.c
|
|
|
cd5d626 |
+++ b/quota_nld.c
|
|
|
cd5d626 |
@@ -403,12 +403,12 @@ static char *build_pid_file_name(void)
|
|
|
cd5d626 |
errstr(_("Undefined program name.\n"));
|
|
|
cd5d626 |
return NULL;
|
|
|
cd5d626 |
}
|
|
|
cd5d626 |
- pid_name = malloc(9 + strlen(progname) + 4 + 1);
|
|
|
cd5d626 |
+ pid_name = malloc(strlen(PID_DIR) + 1 + strlen(progname) + 4 + 1);
|
|
|
cd5d626 |
if (!pid_name) {
|
|
|
cd5d626 |
errstr(_("Not enough memory to build PID file name.\n"));
|
|
|
cd5d626 |
return NULL;
|
|
|
cd5d626 |
}
|
|
|
cd5d626 |
- sprintf(pid_name, "/var/run/%s.pid", progname);
|
|
|
cd5d626 |
+ sprintf(pid_name, "%s/%s.pid", PID_DIR, progname);
|
|
|
cd5d626 |
return pid_name;
|
|
|
cd5d626 |
}
|
|
|
cd5d626 |
|
|
|
cd5d626 |
--
|
|
|
cd5d626 |
2.20.1
|
|
|
cd5d626 |
|