mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 05:22:48 +07:00
Check correct struct member to determine if / has 'ro' flag
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
+20
-2
@@ -149,6 +149,25 @@ static int fsck_all(void)
|
||||
}
|
||||
|
||||
#ifndef SYSROOT
|
||||
/* If / is not listed in fstab, or listed as 'ro', leave it alone */
|
||||
static int fs_readonly_root(struct fstab *fs)
|
||||
{
|
||||
char *tok, *str;
|
||||
|
||||
if (!fs)
|
||||
return 1;
|
||||
|
||||
str = fs->fs_mntops;
|
||||
while ((tok = strtok(str, ","))) {
|
||||
if (!strcmp(tok, "ro"))
|
||||
return 1;
|
||||
|
||||
str = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void fs_remount_root(int fsckerr)
|
||||
{
|
||||
struct fstab *fs;
|
||||
@@ -161,8 +180,7 @@ static void fs_remount_root(int fsckerr)
|
||||
break;
|
||||
}
|
||||
|
||||
/* If / is not listed in fstab, or listed as 'ro', leave it alone */
|
||||
if (!fs || !strcmp(fs->fs_type, "ro"))
|
||||
if (fs_readonly_root(fs))
|
||||
goto out;
|
||||
|
||||
if (fsckerr)
|
||||
|
||||
Reference in New Issue
Block a user