Skip to content

Commit

Permalink
block: try to find the root device on both / and /rom
Browse files Browse the repository at this point in the history
Sometimes / is already overlay mounted, assume /rom contains the real
rootfs.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
  • Loading branch information
lu-zero authored and dangowrt committed May 28, 2023
1 parent c1a8d95 commit 9cd09d4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions block.c
Expand Up @@ -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")))
Expand All @@ -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;
Expand Down

0 comments on commit 9cd09d4

Please sign in to comment.