diff mbox

[03/11] fedfsd: Change the working directory to the default state dir

Message ID 20121019210802.53119.90861.stgit@seurat.1015granger.net
State Accepted
Headers show

Commit Message

Chuck Lever Oct. 19, 2012, 9:08 p.m. UTC
Follow conventional practice of other RPC service daemons.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 src/fedfsd/main.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/src/fedfsd/main.c b/src/fedfsd/main.c
index f0a39d6..fd6bee5 100644
--- a/src/fedfsd/main.c
+++ b/src/fedfsd/main.c
@@ -219,6 +219,10 @@  int main(int argc, char **argv)
 		exit(EXIT_FAILURE);
 
 	if (!foreground) {
+		if (chdir(FEDFS_DEFAULT_STATEDIR) == -1) {
+			xlog(L_ERROR, "chdir: %m");
+			exit(EXIT_FAILURE);
+		}
 		if (daemon(0, 0) == -1) {
 			xlog(L_ERROR, "daemon: %m");
 			exit(EXIT_FAILURE);