From 283abcbc025696d1ef5df0adef43e0b052e0a40d Mon Sep 17 00:00:00 2001 From: Steve Dickson Date: Tue, 21 Mar 2017 10:55:19 -0400 Subject: [PATCH] Try creating statdir once when opening lock file fails (bz 1401561) Signed-off-by: Steve Dickson --- rpcbind-0.2.4-systemd-rundir.patch | 35 ++++++++++++++++++++++++++++++ rpcbind.spec | 7 +++++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 rpcbind-0.2.4-systemd-rundir.patch diff --git a/rpcbind-0.2.4-systemd-rundir.patch b/rpcbind-0.2.4-systemd-rundir.patch new file mode 100644 index 0000000..da08d7a --- /dev/null +++ b/rpcbind-0.2.4-systemd-rundir.patch @@ -0,0 +1,35 @@ +diff -up rpcbind-0.2.4/src/rpcbind.c.orig rpcbind-0.2.4/src/rpcbind.c +--- rpcbind-0.2.4/src/rpcbind.c.orig 2017-03-21 10:12:35.005190509 -0400 ++++ rpcbind-0.2.4/src/rpcbind.c 2017-03-21 10:36:45.510507649 -0400 +@@ -144,6 +144,8 @@ static void rbllist_add(rpcprog_t, rpcve + static void terminate(int); + static void parseargs(int, char *[]); + ++char *systemdtmp = "/usr/bin/systemd-tmpfiles --create rpcbind.conf"; ++ + int + main(int argc, char *argv[]) + { +@@ -151,13 +153,21 @@ main(int argc, char *argv[]) + void *nc_handle; /* Net config handle */ + struct rlimit rl; + int maxrec = RPC_MAXDATASIZE; ++ int once = 1; + + parseargs(argc, argv); + ++tryagain: + /* Check that another rpcbind isn't already running. */ + if ((rpcbindlockfd = (open(RPCBINDDLOCK, +- O_RDONLY|O_CREAT, 0444))) == -1) ++ O_RDONLY|O_CREAT, 0444))) == -1) { ++ if (once) { ++ once = system(systemdtmp); /* set once to avoid a warning */ ++ once = 0; ++ goto tryagain; ++ } + err(1, "%s", RPCBINDDLOCK); ++ } + + if(flock(rpcbindlockfd, LOCK_EX|LOCK_NB) == -1 && errno == EWOULDBLOCK) + errx(1, "another rpcbind is already running. Aborting"); diff --git a/rpcbind.spec b/rpcbind.spec index 15e5676..06b0dc6 100644 --- a/rpcbind.spec +++ b/rpcbind.spec @@ -1,6 +1,6 @@ Name: rpcbind Version: 0.2.4 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Universal Addresses to RPC Program Number Mapper Group: System Environment/Daemons License: BSD @@ -25,6 +25,7 @@ Patch100: rpcbind-0.2.3-systemd-envfile.patch Patch101: rpcbind-0.2.3-systemd-tmpfiles.patch Patch102: rpcbind-0.2.4-runstatdir.patch Patch103: rpcbind-0.2.4-systemd-service.patch +Patch104: rpcbind-0.2.4-systemd-rundir.patch Provides: portmap = %{version}-%{release} Obsoletes: portmap <= 4.0-65.3 @@ -44,6 +45,7 @@ RPC calls on a server on that machine. %patch101 -p1 %patch102 -p1 %patch103 -p1 +%patch104 -p1 %build %ifarch s390 s390x PIE="-fPIE" @@ -137,6 +139,9 @@ fi %{_tmpfilesdir}/%{name}.conf %changelog +* Tue Mar 21 2017 Steve Dickson - 0.2.4-6 +- Try creating statdir once when opening lock file fails (bz 1401561) + * Sat Feb 11 2017 Fedora Release Engineering - 0.2.4-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild