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>
This commit is contained in:
parent
e221ca7613
commit
9b61bd0b39
1 changed files with 3 additions and 1 deletions
4
passt.c
4
passt.c
|
@ -260,7 +260,9 @@ static int sandbox(struct ctx *c)
|
||||||
mount("", "/", "", MS_UNBINDABLE | MS_REC, NULL);
|
mount("", "/", "", MS_UNBINDABLE | MS_REC, NULL);
|
||||||
mount("", TMPDIR, "tmpfs", MS_NODEV | MS_NOEXEC | MS_NOSUID | MS_RDONLY,
|
mount("", TMPDIR, "tmpfs", MS_NODEV | MS_NOEXEC | MS_NOSUID | MS_RDONLY,
|
||||||
"nr_inodes=2,nr_blocks=0");
|
"nr_inodes=2,nr_blocks=0");
|
||||||
chdir(TMPDIR);
|
if (chdir(TMPDIR))
|
||||||
|
return -errno;
|
||||||
|
|
||||||
syscall(SYS_pivot_root, ".", ".");
|
syscall(SYS_pivot_root, ".", ".");
|
||||||
umount2(".", MNT_DETACH | UMOUNT_NOFOLLOW);
|
umount2(".", MNT_DETACH | UMOUNT_NOFOLLOW);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue