[OpenWrt-Devel] [PATCH fstools] block: make sure /etc/ exists on the extroot

Rafał Miłecki zajec5 at gmail.com
Wed Dec 17 14:50:07 EST 2014


Otherwise opening .extroot-uuid could fail.

Signed-off-by: Rafał Miłecki <zajec5 at gmail.com>
---
 block.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/block.c b/block.c
index 107ba64..c29017d 100644
--- a/block.c
+++ b/block.c
@@ -911,6 +911,10 @@ static int check_extroot(char *path)
 			char tag[64];
 			char uuid[64] = { 0 };
 
+			snprintf(tag, sizeof(tag), "%s/etc", path);
+			if (stat(tag, &s))
+				mkdir_p(tag);
+
 			snprintf(tag, sizeof(tag), "%s/etc/.extroot-uuid", path);
 			if (stat(tag, &s)) {
 				fp = fopen(tag, "w+");
-- 
1.8.4.5
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list