[CRIU] [PATCH] util: don't ignore chdir(/) return value

Ruslan Kuprieiev kupruser at gmail.com
Sat Feb 1 17:49:24 PST 2014


Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
---
 util.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/util.c b/util.c
index 32a61b3..d98f61f 100644
--- a/util.c
+++ b/util.c
@@ -593,8 +593,11 @@ int cr_daemon(int nochdir, int noclose)
 		return pid;
 
 	setsid();
-	if (!nochdir)
-		chdir("/");
+	if (!nochdir) {
+		if (chdir("/"))
+			pr_perror("Can't chdir to /");
+			return -1;
+	}
 	if (!noclose) {
 		int fd;
 
-- 
1.8.3.2



More information about the CRIU mailing list