Since ucode commit
4ae7072 "fs: use `getline()` for line wise read operations"
a call to `fs.read("line")` will yield `null` instead of an empty string when
encountering EOF, leading to an infinite loop when parsing loadfile entries.
Solve this issue by checking both for `null` and empty string return values.
Ref: https://forum.openwrt.org/t/x/139951/12
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
return;
}
- let line = null, count = 0;
+ let count = 0;
- while ((line = fd.read("line")) !== "") {
+ for (let line = fd.read("line"); length(line); line = fd.read("line")) {
line = trim(line);
if (length(line) == 0 || ord(line) == 35)