diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2017-07-15 10:59:51 -0700 |
---|---|---|
committer | Florian Fainelli <f.fainelli@gmail.com> | 2017-07-20 08:31:37 -0700 |
commit | 13f252f39d2f870d01884d1b0cf0a91a1a669d03 (patch) | |
tree | ddc889568f8697444bb634501bae3c31be48c1bd /upgraded | |
parent | 85ccb95c1110ad7c08d918f39f7930aab38d56f8 (diff) | |
download | procd-13f252f39d2f870d01884d1b0cf0a91a1a669d03.tar.gz |
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 <mschiffer@universe-factory.net>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Diffstat (limited to 'upgraded')
-rw-r--r-- | upgraded/upgraded.c | 5 |
1 files changed, 4 insertions, 1 deletions
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)); |