[PATCH 1/2] erofs-utils: ignore comments and blank lines in compress hints

Gao Xiang hsiangkao at linux.alibaba.com
Wed Feb 22 20:30:09 AEDT 2023


Identify lines starting with '#' as a comment.

Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
---
 lib/compress_hints.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/compress_hints.c b/lib/compress_hints.c
index 92964eb..3e5c8c8 100644
--- a/lib/compress_hints.c
+++ b/lib/compress_hints.c
@@ -101,6 +101,9 @@ int erofs_load_compress_hints(void)
 		unsigned int pclustersize;
 		char *pattern;
 
+		if (*buf == '#' || *buf == '\n')
+			continue;
+
 		pclustersize = atoi(strtok(buf, "\t "));
 		pattern = strtok(NULL, "\n");
 		if (!pattern || *pattern == '\0') {
-- 
2.36.1



More information about the Linux-erofs mailing list