mirror of https://github.com/vitalif/e2fsprogs
libext2fs: fix EXT2FS_PRETEND_* on non-Linux systems
The debugging environment variables EXT2FS_PRETEND_* were implemented in check_mntent_file(), and this function isn't called on all operating systems. Lift this code up to ext2fs_check_mount_point(), so that these environment variables (which are used in the regression test suite) will work on all platforms. Signed-off-by: Theodore Ts'o <tytso@mit.edu>debian
parent
afaf6db69f
commit
43b7b054cd
|
@ -102,19 +102,6 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file,
|
|||
|
||||
*mount_flags = 0;
|
||||
|
||||
if (getenv("EXT2FS_PRETEND_RO_MOUNT")) {
|
||||
*mount_flags = EXT2_MF_MOUNTED | EXT2_MF_READONLY;
|
||||
if (getenv("EXT2FS_PRETEND_ROOTFS"))
|
||||
*mount_flags = EXT2_MF_ISROOT;
|
||||
return 0;
|
||||
}
|
||||
if (getenv("EXT2FS_PRETEND_RW_MOUNT")) {
|
||||
*mount_flags = EXT2_MF_MOUNTED;
|
||||
if (getenv("EXT2FS_PRETEND_ROOTFS"))
|
||||
*mount_flags = EXT2_MF_ISROOT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((f = setmntent (mtab_file, "r")) == NULL) {
|
||||
if (errno == ENOENT) {
|
||||
if (getenv("EXT2FS_NO_MTAB_OK"))
|
||||
|
@ -377,6 +364,19 @@ errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags,
|
|||
{
|
||||
errcode_t retval = 0;
|
||||
|
||||
if (getenv("EXT2FS_PRETEND_RO_MOUNT")) {
|
||||
*mount_flags = EXT2_MF_MOUNTED | EXT2_MF_READONLY;
|
||||
if (getenv("EXT2FS_PRETEND_ROOTFS"))
|
||||
*mount_flags = EXT2_MF_ISROOT;
|
||||
return 0;
|
||||
}
|
||||
if (getenv("EXT2FS_PRETEND_RW_MOUNT")) {
|
||||
*mount_flags = EXT2_MF_MOUNTED;
|
||||
if (getenv("EXT2FS_PRETEND_ROOTFS"))
|
||||
*mount_flags = EXT2_MF_ISROOT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (is_swap_device(device)) {
|
||||
*mount_flags = EXT2_MF_MOUNTED | EXT2_MF_SWAP;
|
||||
strncpy(mtpt, "<swap>", mtlen);
|
||||
|
|
Loading…
Reference in New Issue