From 13f252f39d2f870d01884d1b0cf0a91a1a669d03 Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Sat, 15 Jul 2017 10:59:51 -0700 Subject: [PATCH] upgraded: Check chroot() return value Check the chroot() return value, fixes unused return value warnings/errors: procd-2017-06-22-e5e99c46/upgraded/upgraded.c:78:8: error: ignoring return value of 'chroot', declared with attribute warn_unused_result [-Werror=unused-result] chroot("."); Fixes: 056d8ddda8d5 ("upgraded: link dynamically, chroot during exec") Reviewed-by: Matthias Schiffer Signed-off-by: Florian Fainelli --- upgraded/upgraded.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/upgraded/upgraded.c b/upgraded/upgraded.c index 09c623c..220da79 100644 --- a/upgraded/upgraded.c +++ b/upgraded/upgraded.c @@ -78,7 +78,10 @@ int main(int argc, char **argv) return 1; } - chroot("."); + if (chroot(".") < 0) { + fprintf(stderr, "failed to chroot: %s\n", strerror(errno)); + return 1; + } if (fchdir(fd) == -1) { fprintf(stderr, "failed to chdir to prefix directory: %s\n", strerror(errno)); -- 2.30.2