diff options
author | NeilBrown <neilb@suse.com> | 2016-11-16 10:53:07 -0500 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2016-11-19 10:21:57 -0500 |
commit | 2e78e6fb51292fea798355e5cb749dbc1de26ca6 (patch) | |
tree | 5d8c0733fb4c275250be384a63c2f914e23a2aba /src/rpcbind.c | |
parent | 0cc39c519278b15ede3a5268415b70a2378a52c0 (diff) | |
download | rpcbind-2e78e6fb51292fea798355e5cb749dbc1de26ca6.tar.gz |
Move default state-dir to a subdirectory of /var/run
rpcbind can save state in a file to allow restart without forgetting
about running services.
The default location is currently "/tmp" which is
not ideal for system files. It is particularly unpleasant
to put simple files there rather than creating a directory
to contain them.
On a modern Linux system it is preferable to use /run, and there it is
even more consistent with practice to use a subdirectory.
This directory needs to be create one each boot, and while there are
tools (e.g. systemd-tmpfiles) which can do that it is cleaner to keep
rpcbind self-contained and have it create the directory.
So change the default location to /var/run/rpcbind, and create that
directory. If a different user-id is used, we need to create
and chown the directory before dropping privileges. We do this
with care so avoid chowning the wrong thing by mistake.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'src/rpcbind.c')
-rw-r--r-- | src/rpcbind.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/rpcbind.c b/src/rpcbind.c index 87ccdc2..8db8dfc 100644 --- a/src/rpcbind.c +++ b/src/rpcbind.c @@ -263,6 +263,11 @@ main(int argc, char *argv[]) syslog(LOG_ERR, "cannot get uid of '%s': %m", id); exit(1); } +#ifdef WARMSTART + if (warmstart) { + mkdir_warmstart(p->pw_uid); + } +#endif if (setgid(p->pw_gid) == -1) { syslog(LOG_ERR, "setgid to '%s' (%d) failed: %m", id, p->pw_gid); exit(1); |