mirror of https://github.com/vitalif/e2fsprogs
ChangeLog, ismounted.c:
ismounted.c (check_mntent_file): Use a test file in / to check to see if the root filesystem is mounted read-only. This protects against the case where /etc might not be on /, as well as the case where /etc/mtab doesn't exist. (Both are should-never happen scenarios, but you never know...)bitmap-optimize
parent
a35bcab0dd
commit
997b820e94
|
@ -1,3 +1,11 @@
|
||||||
|
2001-06-15 Theodore Tso <tytso@valinux.com>
|
||||||
|
|
||||||
|
* ismounted.c (check_mntent_file): Use a test file in / to check
|
||||||
|
to see if the root filesystem is mounted read-only. This
|
||||||
|
protects against the case where /etc might not be on /, as
|
||||||
|
well as the case where /etc/mtab doesn't exist. (Both are
|
||||||
|
should-never happen scenarios, but you never know...)
|
||||||
|
|
||||||
2001-06-14 Theodore Tso <tytso@valinux.com>
|
2001-06-14 Theodore Tso <tytso@valinux.com>
|
||||||
|
|
||||||
* ismounted.c (ext2fs_check_if_mounted): Fix grammer in comment.
|
* ismounted.c (ext2fs_check_if_mounted): Fix grammer in comment.
|
||||||
|
|
|
@ -92,13 +92,15 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file,
|
||||||
*/
|
*/
|
||||||
if (!strcmp(mnt->mnt_dir, "/")) {
|
if (!strcmp(mnt->mnt_dir, "/")) {
|
||||||
is_root:
|
is_root:
|
||||||
|
#define TEST_FILE "/.ismount-test-file"
|
||||||
*mount_flags |= EXT2_MF_ISROOT;
|
*mount_flags |= EXT2_MF_ISROOT;
|
||||||
fd = open(MOUNTED, O_RDWR);
|
fd = open(TEST_FILE, O_RDWR|O_CREAT);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
if (errno == EROFS)
|
if (errno == EROFS)
|
||||||
*mount_flags |= EXT2_MF_READONLY;
|
*mount_flags |= EXT2_MF_READONLY;
|
||||||
} else
|
} else
|
||||||
close(fd);
|
close(fd);
|
||||||
|
(void) unlink(TEST_FILE);
|
||||||
}
|
}
|
||||||
endmntent (f);
|
endmntent (f);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue