mirror of
https://github.com/AltraMayor/f3.git
synced 2025-09-07 22:28:39 -04:00
adjust_dev_path() struggles with relative paths
Calling "./f3write a" returns the following error: f3write: Can't change root directory to a at adjust_dev_path(): No such file or directory This patch avoids this bug.
This commit is contained in:
parent
283f386448
commit
204555d5df
3
utils.c
3
utils.c
@ -28,14 +28,13 @@ void adjust_dev_path(const char **dev_path)
|
|||||||
if (chdir(*dev_path)) {
|
if (chdir(*dev_path)) {
|
||||||
err(errno, "Can't change working directory to %s at %s()", *dev_path, __func__);
|
err(errno, "Can't change working directory to %s at %s()", *dev_path, __func__);
|
||||||
}
|
}
|
||||||
|
*dev_path = ".";
|
||||||
|
|
||||||
if (!chroot(*dev_path)) {
|
if (!chroot(*dev_path)) {
|
||||||
assert(!chdir("/"));
|
assert(!chdir("/"));
|
||||||
} else if (errno != EPERM) {
|
} else if (errno != EPERM) {
|
||||||
err(errno, "Can't change root directory to %s at %s()", *dev_path, __func__);
|
err(errno, "Can't change root directory to %s at %s()", *dev_path, __func__);
|
||||||
}
|
}
|
||||||
|
|
||||||
*dev_path = ".";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *adjust_unit(double *ptr_bytes)
|
const char *adjust_unit(double *ptr_bytes)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user