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>
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));