summaryrefslogtreecommitdiffstats
path: root/utils/gssd
diff options
context:
space:
mode:
authorDavid Hardeman <david@hardeman.nu>2015-01-21 16:16:59 -0500
committerSteve Dickson <steved@redhat.com>2015-01-23 14:19:09 -0500
commit7addf9dadb35e8f6a770b943e67ddc77e1bc97ba (patch)
tree80f3d61941272f055676823bc3a14fe8009525c2 /utils/gssd
parentf980298853d9b12a222421342418732f65883c30 (diff)
downloadnfs-utils-7addf9dadb35e8f6a770b943e67ddc77e1bc97ba.tar.gz
nfs-utils-7addf9dadb35e8f6a770b943e67ddc77e1bc97ba.tar.xz
nfs-utils-7addf9dadb35e8f6a770b943e67ddc77e1bc97ba.zip
cleanup daemonization code
The daemonization init/ready functions have parameters that are never used, require the caller to keep track of some pipefds that it has no interest in and which might not be used in some scenarios. Cleanup both functions a bit. The idea here is also that these two functions might be good points to insert more systemd init code later (sd_notify()). Also, statd had a private copy of the daemonization code for unknown reasons...so make it use the generic version instead. Signed-off-by: David H?rdeman <david@hardeman.nu> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/gssd')
-rw-r--r--utils/gssd/gssd.c4
-rw-r--r--utils/gssd/gssd.h1
-rw-r--r--utils/gssd/gssd_main_loop.c3
-rw-r--r--utils/gssd/svcgssd.c8
4 files changed, 4 insertions, 12 deletions
diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
index 6b8b863..dc84b3e 100644
--- a/utils/gssd/gssd.c
+++ b/utils/gssd/gssd.c
@@ -66,7 +66,6 @@ int root_uses_machine_creds = 1;
unsigned int context_timeout = 0;
unsigned int rpc_timeout = 5;
char *preferred_realm = NULL;
-int pipefds[2] = { -1, -1 };
void
sig_die(int signal)
@@ -206,8 +205,7 @@ main(int argc, char *argv[])
if (gssd_check_mechs() != 0)
errx(1, "Problem with gssapi library");
- if (!fg)
- mydaemon(0, 0, pipefds);
+ daemon_init(fg);
signal(SIGINT, sig_die);
signal(SIGTERM, sig_die);
diff --git a/utils/gssd/gssd.h b/utils/gssd/gssd.h
index 48f4ad8..84479e8 100644
--- a/utils/gssd/gssd.h
+++ b/utils/gssd/gssd.h
@@ -68,7 +68,6 @@ extern int root_uses_machine_creds;
extern unsigned int context_timeout;
extern unsigned int rpc_timeout;
extern char *preferred_realm;
-extern int pipefds[2];
TAILQ_HEAD(clnt_list_head, clnt_info) clnt_list;
diff --git a/utils/gssd/gssd_main_loop.c b/utils/gssd/gssd_main_loop.c
index 6946ab6..9787883 100644
--- a/utils/gssd/gssd_main_loop.c
+++ b/utils/gssd/gssd_main_loop.c
@@ -252,8 +252,7 @@ gssd_run()
exit(1);
}
- /* release the parent after the initial dir scan */
- release_parent(pipefds);
+ daemon_ready();
}
gssd_poll(pollarray, pollsize);
}
diff --git a/utils/gssd/svcgssd.c b/utils/gssd/svcgssd.c
index 0385725..f1b4347 100644
--- a/utils/gssd/svcgssd.c
+++ b/utils/gssd/svcgssd.c
@@ -62,8 +62,6 @@
#include "gss_util.h"
#include "err_util.h"
-static int pipefds[2] = { -1, -1 };
-
void
sig_die(int signal)
{
@@ -157,8 +155,7 @@ main(int argc, char *argv[])
exit(1);
}
- if (!fg)
- mydaemon(0, 0, pipefds);
+ daemon_init(fg);
signal(SIGINT, sig_die);
signal(SIGTERM, sig_die);
@@ -187,8 +184,7 @@ main(int argc, char *argv[])
}
}
- if (!fg)
- release_parent(pipefds);
+ daemon_ready();
nfs4_init_name_mapping(NULL); /* XXX: should only do this once */
gssd_run();