linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH rpcbind] Move default state-dir to /run/rpcbind
@ 2016-11-11  3:36 NeilBrown
  2016-11-11 21:00 ` [Libtirpc-devel] " Mike Frysinger
       [not found] ` <669e90b0-6011-7b82-4e37-f1e3bf292026@RedHat.com>
  0 siblings, 2 replies; 13+ messages in thread
From: NeilBrown @ 2016-11-11  3:36 UTC (permalink / raw)
  To: Steve Dickson; +Cc: libtirpc-devel, Linux NFS Mailing List

[-- Attachment #1: Type: text/plain, Size: 2092 bytes --]


rpcbind can save state in a file to allow restart without forgetting
about running services.

The default location is currently "/tmp" which is an over-used
directory that isn't really suitable for system files.
The modern preferences would be a subdirectory of "/run", which can
be selected with a ./configure option.  That subdirectory would still need
to be created by something.

It is trivial for rpcbind to create the directory itself, and harmless
to try if it already exists, so:
- add a "mkdir" when saving state data
- change the default to /run/rpcbind (currently used by Debian)
- remove the default settign in the code, just use the one
  in configure.ac

Signed-off-by: NeilBrown <neilb@suse.com>
---
 configure.ac    | 4 ++--
 src/warmstart.c | 5 +----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index f84921eb27fb..fe7d0b068439 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,8 +22,8 @@ AC_ARG_ENABLE([warmstarts],
 AM_CONDITIONAL(WARMSTART, test x$enable_warmstarts = xyes)
 
 AC_ARG_WITH([statedir],
-  AS_HELP_STRING([--with-statedir=ARG], [use ARG as state dir @<:@default=/tmp@:>@])
-  ,, [with_statedir=/tmp])
+  AS_HELP_STRING([--with-statedir=ARG], [use ARG as state dir @<:@default=/run/rpcbind@:>@])
+  ,, [with_statedir=/run/rpcbind])
 AC_SUBST([statedir], [$with_statedir])
 
 AC_ARG_WITH([rpcuser],
diff --git a/src/warmstart.c b/src/warmstart.c
index 122a058b7954..3896027e62ba 100644
--- a/src/warmstart.c
+++ b/src/warmstart.c
@@ -48,10 +48,6 @@
 
 #include "rpcbind.h"
 
-#ifndef RPCBIND_STATEDIR
-#define RPCBIND_STATEDIR "/tmp"
-#endif
-
 /* These files keep the pmap_list and rpcb_list in XDR format */
 #define	RPCBFILE	RPCBIND_STATEDIR "/rpcbind.xdr"
 #ifdef PORTMAP
@@ -141,6 +137,7 @@ error:
 void
 write_warmstart()
 {
+	(void) mkdir(RPCBIND_STATEDIR, 0770);
 	(void) write_struct(RPCBFILE, (xdrproc_t)xdr_rpcblist_ptr, &list_rbl);
 #ifdef PORTMAP
 	(void) write_struct(PMAPFILE, (xdrproc_t)xdr_pmaplist_ptr, &list_pml);
-- 
2.10.2


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2016-11-16 10:17 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-11  3:36 [PATCH rpcbind] Move default state-dir to /run/rpcbind NeilBrown
2016-11-11 21:00 ` [Libtirpc-devel] " Mike Frysinger
2016-11-13 23:09   ` NeilBrown
2016-11-14  7:05     ` [PATCH rpcbind v2] Move default state-dir to a subdirectory of /tmp NeilBrown
2016-11-15 19:54       ` [Libtirpc-devel] " Steve Dickson
2016-11-16  1:34         ` NeilBrown
2016-11-16 10:17           ` Steve Dickson
2016-11-14 19:12     ` [Libtirpc-devel] [PATCH rpcbind] Move default state-dir to /run/rpcbind Mike Frysinger
2016-11-14 19:26       ` Steve Dickson
2016-11-14 20:12         ` Mike Frysinger
     [not found] ` <669e90b0-6011-7b82-4e37-f1e3bf292026@RedHat.com>
2016-11-15  6:36   ` NeilBrown
2016-11-15 16:02     ` Steve Dickson
2016-11-15 20:28       ` NeilBrown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).