[lxc-devel] [PATCH] Fix compile error when building with -Wp, -D_FORTIFY_SOURCE=2

Dwight Engen dwight.engen at oracle.com
Fri Nov 30 14:43:50 UTC 2012


Fedora by default builds with this flag, and complains about not checking the
return from fchdir. There isn't much we can do if we can't change back to the
original directory, so just log an error message.

Signed-off-by: Dwight Engen <dwight.engen at oracle.com>
---
 src/lxc/conf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index e3f1d53..c02e109 100644
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -928,7 +928,8 @@ static void run_makedev(char *devpath)
 	}
 	if (run_buffer("/sbin/MAKEDEV console"))
 		INFO("Error running MAKEDEV console in %s", devpath);
-	fchdir(curd);
+	if (fchdir(curd) < 0)
+		ERROR("Error restoring cwd");
 	close(curd);
 }
 
-- 
1.7.11.7





More information about the lxc-devel mailing list