rpcbind/rpcbind-0.2.4-systemd-rundir.patch

43 lines
1.2 KiB
Diff
Raw Permalink Normal View History

--- rpcbind-1.2.6/src/rpcbind.c 2023-03-27 15:17:28.116410124 +0800
+++ rpcbind-1.2.6-dev/src/rpcbind.c 2023-03-27 15:37:14.215749666 +0800
@@ -143,6 +143,10 @@ static void rbllist_add(rpcprog_t, rpcve
2019-09-30 11:16:23 -04:00
static void terminate(int);
static void parseargs(int, char *[]);
+#ifndef WITHOUT_SYSTEMD
2019-09-30 11:16:23 -04:00
+char *systemdtmp = "/usr/bin/systemd-tmpfiles --create rpcbind.conf";
+#endif
2019-09-30 11:16:23 -04:00
+
int
main(int argc, char *argv[])
{
@@ -150,13 +154,27 @@ main(int argc, char *argv[])
2019-09-30 11:16:23 -04:00
void *nc_handle; /* Net config handle */
struct rlimit rl;
int maxrec = RPC_MAXDATASIZE;
+#ifndef WITHOUT_SYSTEMD
2019-09-30 11:16:23 -04:00
+ int once = 1;
+#endif
2019-09-30 11:16:23 -04:00
parseargs(argc, argv);
+#ifndef WITHOUT_SYSTEMD
2019-09-30 11:16:23 -04:00
+tryagain:
+#endif
2019-09-30 11:16:23 -04:00
/* Check that another rpcbind isn't already running. */
if ((rpcbindlockfd = (open(RPCBINDDLOCK,
- O_RDONLY|O_CREAT, 0444))) == -1)
+ O_RDONLY|O_CREAT, 0444))) == -1) {
+#ifndef WITHOUT_SYSTEMD
2019-09-30 11:16:23 -04:00
+ if (once) {
+ once = system(systemdtmp); /* set once to avoid a warning */
+ once = 0;
+ goto tryagain;
+ }
+#endif
2019-09-30 11:16:23 -04:00
err(1, "%s", RPCBINDDLOCK);
+ }
if(flock(rpcbindlockfd, LOCK_EX|LOCK_NB) == -1 && errno == EWOULDBLOCK)
errx(1, "another rpcbind is already running. Aborting");