summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Golle2024-02-21 00:10:53 +0000
committerDaniel Golle2024-02-24 03:55:53 +0000
commit1901aba90b6841ec1a99a25224a92d2519c603fd (patch)
treea2780742530289843e4d8a115e3eab709ade7730
parent2f949727e49a65893b1ccb9539ed6421f219dfb9 (diff)
system: break infite loop resolving rootfs type
When running procd outside of OpenWrt, e.g. for debugging or research situations inside a container environment, an inifite loop can occur when trying to determine the rootfs type. Make sure that doesn't happen. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-rw-r--r--system.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/system.c b/system.c
index 1f2be33..8df606f 100644
--- a/system.c
+++ b/system.c
@@ -94,8 +94,12 @@ static const char *system_rootfs_type(void) {
* lowerdir, as that can point to "/" being a previous
* overlay mount (after firstboot or sysuprade config
* restore). Hence just assume the lowerdir is "/rom" and
- * restart searching for that instead.
+ * restart searching for that instead if that's not
+ * already the case.
*/
+ if (!strcmp(mp, "/rom"))
+ break;
+
mp = "/rom";
fseek(mounts, 0, SEEK_SET);
continue;