diff --git a/quota-4.05-Make-a-directory-for-quota_nld-PID-file-configurable.patch b/quota-4.05-Make-a-directory-for-quota_nld-PID-file-configurable.patch new file mode 100644 index 0000000..51a9aa2 --- /dev/null +++ b/quota-4.05-Make-a-directory-for-quota_nld-PID-file-configurable.patch @@ -0,0 +1,74 @@ +From bbcf9eedb2299ab55a0ae208e196eb2ca59ad97e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Thu, 30 May 2019 13:20:25 +0200 +Subject: [PATCH] Make a directory for quota_nld PID file configurable +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +While Filesystem Hierarchy Standard prescribes /var/run path for +storing PID files, some (systemd-based) distributions uses /run. + +This patch adds a --with-pid-dir=DIRECTORY option to the ./configure +script. The option enables to change the path. Default one is +/var/run as used to be until now. + +(I did not use $localstatedir environment variable because Autoconf +manual allows using "precious" variables only in a makefile.) + +Signed-off-by: Petr Písař +--- + configure.ac | 10 ++++++++++ + quota_nld.c | 4 ++-- + 2 files changed, 12 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index b783568..3cb57c5 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -277,6 +277,15 @@ AS_IF([test "$with_proc_mounts" != "no"], [ + AC_DEFINE_UNQUOTED([ALT_MTAB], ["$with_proc_mounts"], [File with mounted filesystems]) + ]) + ++AC_ARG_WITH([pid-dir], ++ [AS_HELP_STRING([--with-pid-dir=DIRECTORY], [Create PID files in this directory instead of /var/run])], ++ [with_pid_dir="$withval"] ++) ++AS_IF([test "X$with_pid_dir" == "X" -o "$with_pid_dir" == "yes" -o "$with_pid_dir" == "no"],[ ++ with_pid_dir="/var/run" ++]) ++AC_DEFINE_UNQUOTED([PID_DIR], ["$with_pid_dir"], [Directory for PID files]) ++ + AC_DEFINE_UNQUOTED([COMPILE_OPTS], ["$COMPILE_OPTS"], [Configuration options]) + + AC_CONFIG_FILES([ +@@ -297,6 +306,7 @@ Build configuration: + libwrap: ${build_libwrap} + netlink: ${build_netlink} + nls: ${enable_nls} ++ pid-dir: ${with_pid_dir} + proc-mounts: ${with_proc_mounts} + rpc: ${build_rpc} + rpcsetquota: ${enable_rpcsetquota} +diff --git a/quota_nld.c b/quota_nld.c +index ac24bdb..72d99a9 100644 +--- a/quota_nld.c ++++ b/quota_nld.c +@@ -403,12 +403,12 @@ static char *build_pid_file_name(void) + errstr(_("Undefined program name.\n")); + return NULL; + } +- pid_name = malloc(9 + strlen(progname) + 4 + 1); ++ pid_name = malloc(strlen(PID_DIR) + 1 + strlen(progname) + 4 + 1); + if (!pid_name) { + errstr(_("Not enough memory to build PID file name.\n")); + return NULL; + } +- sprintf(pid_name, "/var/run/%s.pid", progname); ++ sprintf(pid_name, "%s/%s.pid", PID_DIR, progname); + return pid_name; + } + +-- +2.20.1 + diff --git a/quota.spec b/quota.spec index 74068df..6966586 100644 --- a/quota.spec +++ b/quota.spec @@ -13,7 +13,7 @@ Name: quota Epoch: 1 Version: 4.05 -Release: 3%{?dist} +Release: 4%{?dist} Summary: System administration tools for monitoring users' disk usage # quota_nld.c, quotaio_xfs.h: GPLv2 # bylabel.c copied from util-linux: GPLv2+ @@ -75,8 +75,11 @@ Patch7: quota-4.05-rpc-Clarify-error-message-when-cannot-connect-to-rpc.patch # 6/6 Patch8: quota-4.05-quotaops-Make-error-string-translatable.patch # Fix Free Software Foundation's postal address, -# in upstream after 4.05 +# , in upstream after 4.05 Patch9: quota-4.05-COPYING-Update-mailing-address.patch +# Move quota_nld.pid file to /run, +# , proposed to the upstream +Patch10: quota-4.05-Make-a-directory-for-quota_nld-PID-file-configurable.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: bash @@ -206,6 +209,7 @@ Linux/UNIX environment. %patch7 -p1 %patch8 -p1 %patch9 -p1 +%patch10 -p1 # Regenerate build scripts autoreconf -f -i @@ -230,6 +234,7 @@ autoreconf -f -i --disable-netlink \ %endif --enable-nls \ + --with-pid-dir=/run \ --disable-rpath \ %if %{with quota_enables_rpc} --enable-rpc=yes \ @@ -354,6 +359,9 @@ make check %changelog +* Thu May 30 2019 Petr Pisar - 1:4.05-4 +- Move quota_nld.pid file to /run (upstream patch #49) + * Wed May 29 2019 Petr Pisar - 1:4.05-3 - Run quota_nld service as tty group diff --git a/quota_nld.service b/quota_nld.service index 1937aa2..d533d01 100644 --- a/quota_nld.service +++ b/quota_nld.service @@ -6,7 +6,7 @@ After=syslog.target Type=forking EnvironmentFile=-/etc/sysconfig/quota_nld ExecStart=/usr/sbin/quota_nld $QUOTA_NLD_OPTS -PIDFile=/var/run/quota_nld.pid +PIDFile=/run/quota_nld.pid Group=tty [Install]