1
0
forked from rpms/rpcbind
rpcbind/rpcbind-0.2.4-systemd-rundir.patch
Steve Dickson c01c84e6ff Updated to latest upstream RC release: rpcbind-1_2_7-rc2
Signed-off-by: Steve Dickson <steved@redhat.com>
2023-02-28 13:04:39 -05:00

36 lines
1.1 KiB
Diff

diff -up rpcbind-1.2.6/src/rpcbind.c.orig rpcbind-1.2.6/src/rpcbind.c
--- rpcbind-1.2.6/src/rpcbind.c.orig 2022-07-12 16:25:36.422972803 -0400
+++ rpcbind-1.2.6/src/rpcbind.c 2022-07-12 16:26:00.679085433 -0400
@@ -143,6 +143,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[])
{
@@ -150,13 +152,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");