diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2022-02-25 22:42:36 +0100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-02-25 22:42:36 +0100 |
commit | 9b61bd0b392ea1af6717d03e20dcc418ba73f575 (patch) | |
tree | 38b3b92ef4df37e3c388869f9b092db3c92d3dfd /passt.c | |
parent | e221ca761394b1431b1ca8c66ae83744dc629006 (diff) | |
download | passt-9b61bd0b392ea1af6717d03e20dcc418ba73f575.tar passt-9b61bd0b392ea1af6717d03e20dcc418ba73f575.tar.gz passt-9b61bd0b392ea1af6717d03e20dcc418ba73f575.tar.bz2 passt-9b61bd0b392ea1af6717d03e20dcc418ba73f575.tar.lz passt-9b61bd0b392ea1af6717d03e20dcc418ba73f575.tar.xz passt-9b61bd0b392ea1af6717d03e20dcc418ba73f575.tar.zst passt-9b61bd0b392ea1af6717d03e20dcc418ba73f575.zip |
passt: Explicitly check return value of chdir()
...it doesn't actually matter as we're checking errno at the very
end, but, depending on build flags, chdir() might be declared with
warn_unused_result and the compiler issues a warning.
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'passt.c')
-rw-r--r-- | passt.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -260,7 +260,9 @@ static int sandbox(struct ctx *c) mount("", "/", "", MS_UNBINDABLE | MS_REC, NULL); mount("", TMPDIR, "tmpfs", MS_NODEV | MS_NOEXEC | MS_NOSUID | MS_RDONLY, "nr_inodes=2,nr_blocks=0"); - chdir(TMPDIR); + if (chdir(TMPDIR)) + return -errno; + syscall(SYS_pivot_root, ".", "."); umount2(".", MNT_DETACH | UMOUNT_NOFOLLOW); |