xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-devtools/unfs3/unfs3/fix_compile_warning.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1daemon.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) {
26