blob: aada0141175f0b94aebd2b66f3c6f60c6d6239ab [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001daemon.c: Check exit code of chdir()
2
3Stop the compile warning and fix the code to act on a chdir() failure.
4If this one does fail something is very, very wrong.
5
6Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
7
8Upstream-Status: Submitted http://sourceforge.net/p/unfs3/bugs/5/
9
10---
11 daemon.c | 3 ++-
12 1 file changed, 2 insertions(+), 1 deletion(-)
13
14--- a/daemon.c
15+++ b/daemon.c
16@@ -964,7 +964,8 @@ int main(int argc, char **argv)
17 sigaction(SIGALRM, &act, NULL);
18
19 /* don't make directory we started in busy */
20- chdir("/");
21+ if(chdir("/") < 0)
22+ daemon_exit(0);
23
24 /* detach from terminal */
25 if (opt_detach) {