2023-03-21 15:09:00 +08:00
|
|
|
--- 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 *[]);
|
|
|
|
|
|
2023-03-21 15:09:00 +08:00
|
|
|
+#ifndef WITHOUT_SYSTEMD
|
2019-09-30 11:16:23 -04:00
|
|
|
+char *systemdtmp = "/usr/bin/systemd-tmpfiles --create rpcbind.conf";
|
2023-03-21 15:09:00 +08:00
|
|
|
+#endif
|
2019-09-30 11:16:23 -04:00
|
|
|
+
|
|
|
|
|
int
|
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
|
{
|
2023-03-21 15:09:00 +08:00
|
|
|
@@ -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;
|
2023-03-21 15:09:00 +08:00
|
|
|
+#ifndef WITHOUT_SYSTEMD
|
2019-09-30 11:16:23 -04:00
|
|
|
+ int once = 1;
|
2023-03-21 15:09:00 +08:00
|
|
|
+#endif
|
2019-09-30 11:16:23 -04:00
|
|
|
|
|
|
|
|
parseargs(argc, argv);
|
|
|
|
|
|
2023-03-21 15:09:00 +08:00
|
|
|
+#ifndef WITHOUT_SYSTEMD
|
2019-09-30 11:16:23 -04:00
|
|
|
+tryagain:
|
2023-03-21 15:09:00 +08:00
|
|
|
+#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) {
|
2023-03-21 15:09:00 +08:00
|
|
|
+#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;
|
|
|
|
|
+ }
|
2023-03-21 15:09:00 +08:00
|
|
|
+#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");
|