mirror of
https://github.com/troglobit/finit.git
synced 2026-11-09 16:21:24 +00:00
Check correct struct member to determine if / has 'ro' flag
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
1c941fdfbb
commit
9867fd82df
1 file changed
+20
-2
+20
-2
@@ -149,6 +149,25 @@ static int fsck_all(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SYSROOT
|
#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)
|
static void fs_remount_root(int fsckerr)
|
||||||
{
|
{
|
||||||
struct fstab *fs;
|
struct fstab *fs;
|
||||||
@@ -161,8 +180,7 @@ static void fs_remount_root(int fsckerr)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If / is not listed in fstab, or listed as 'ro', leave it alone */
|
if (fs_readonly_root(fs))
|
||||||
if (!fs || !strcmp(fs->fs_type, "ro"))
|
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (fsckerr)
|
if (fsckerr)
|
||||||
|
|||||||
Reference in new issue
Block a user