Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | daemon.c: Check exit code of chdir() |
| 2 | |
| 3 | Stop the compile warning and fix the code to act on a chdir() failure. |
| 4 | If this one does fail something is very, very wrong. |
| 5 | |
| 6 | Signed-off-by: Jason Wessel <jason.wessel@windriver.com> |
| 7 | |
| 8 | Upstream-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) { |