summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Barbato2023-01-03 11:06:58 +0000
committerDaniel Golle2023-05-28 16:01:32 +0000
commit9cd09d4269bb15710b5d9bd72573ef243eb2927c (patch)
tree795c92c3fbaa58d7fbd83ef650a024f57004036a
parentc1a8d95116672e0ab85ca7f1d67e1a2886035c8b (diff)
block: try to find the root device on both / and /rom
Sometimes / is already overlay mounted, assume /rom contains the real rootfs. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
-rw-r--r--block.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/block.c b/block.c
index 28eac59..7b2ea8f 100644
--- a/block.c
+++ b/block.c
@@ -1397,14 +1397,14 @@ static int find_block_ubi_RO(libubi_t libubi, char *name, char *part, int plen)
}
#endif
-static int find_root_dev(char *buf, int len)
+static int find_dev(const char *path, char *buf, int len)
{
DIR *d;
dev_t root;
struct stat s;
struct dirent *e;
- if (stat("/", &s))
+ if (stat(path, &s))
return -1;
if (!(d = opendir("/dev")))
@@ -1426,6 +1426,15 @@ static int find_root_dev(char *buf, int len)
return -1;
}
+static int find_root_dev(char *buf, int len)
+{
+ int err = find_dev("/", buf, len);
+ if (err)
+ err = find_dev("/rom", buf, len);
+
+ return err;
+}
+
static int test_fs_support(const char *name)
{
char line[128], *p;