Blame SOURCES/rpcbind-0.2.4-systemd-rundir.patch

6a6243
diff -up rpcbind-0.2.4/src/rpcbind.c.orig rpcbind-0.2.4/src/rpcbind.c
6a6243
--- rpcbind-0.2.4/src/rpcbind.c.orig	2017-03-21 10:12:35.005190509 -0400
6a6243
+++ rpcbind-0.2.4/src/rpcbind.c	2017-03-21 10:36:45.510507649 -0400
6a6243
@@ -144,6 +144,8 @@ static void rbllist_add(rpcprog_t, rpcve
6a6243
 static void terminate(int);
6a6243
 static void parseargs(int, char *[]);
6a6243
 
6a6243
+char *systemdtmp = "/usr/bin/systemd-tmpfiles --create rpcbind.conf";
6a6243
+
6a6243
 int
6a6243
 main(int argc, char *argv[])
6a6243
 {
6a6243
@@ -151,13 +153,21 @@ main(int argc, char *argv[])
6a6243
 	void *nc_handle;	/* Net config handle */
6a6243
 	struct rlimit rl;
6a6243
 	int maxrec = RPC_MAXDATASIZE;
6a6243
+	int once = 1;
6a6243
 
6a6243
 	parseargs(argc, argv);
6a6243
 
6a6243
+tryagain:
6a6243
 	/* Check that another rpcbind isn't already running. */
6a6243
 	if ((rpcbindlockfd = (open(RPCBINDDLOCK,
6a6243
-	    O_RDONLY|O_CREAT, 0444))) == -1)
6a6243
+	    O_RDONLY|O_CREAT, 0444))) == -1) {
6a6243
+		if (once) {
6a6243
+			once = system(systemdtmp); /* set once to avoid a warning */
6a6243
+			once = 0;
6a6243
+			goto tryagain; 
6a6243
+		}
6a6243
 		err(1, "%s", RPCBINDDLOCK);
6a6243
+	}
6a6243
 
6a6243
 	if(flock(rpcbindlockfd, LOCK_EX|LOCK_NB) == -1 && errno == EWOULDBLOCK)
6a6243
 		errx(1, "another rpcbind is already running. Aborting");