mirror of
https://github.com/AltraMayor/f3.git
synced 2025-08-03 18:46:00 -04:00
f3read, f3write: chroot(2) to source/target dir if allowed
This commit is contained in:
parent
d01f5cad6e
commit
2a6ac36ca7
6
utils.c
6
utils.c
@ -29,6 +29,12 @@ void adjust_dev_path(const char **dev_path)
|
||||
err(errno, "Can't change working directory to %s at %s()", *dev_path, __func__);
|
||||
}
|
||||
|
||||
if (!chroot(*dev_path)) {
|
||||
assert(!chdir("/"));
|
||||
} else if (errno != EPERM) {
|
||||
err(errno, "Can't change root directory to %s at %s()", *dev_path, __func__);
|
||||
}
|
||||
|
||||
*dev_path = ".";
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user