[PATCH] erofs-utils: fix `--blobdev=X`

Gao Xiang hsiangkao at linux.alibaba.com
Sun Apr 27 12:15:55 AEST 2025


Create one if the file doesn't exist.

Fixes: b6b741d8daaf ("erofs-utils: lib: get rid of tmpfile()")
Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
---
 lib/blobchunk.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/blobchunk.c b/lib/blobchunk.c
index e6386d6..301f46a 100644
--- a/lib/blobchunk.c
+++ b/lib/blobchunk.c
@@ -627,7 +627,8 @@ int erofs_blob_init(const char *blobfile_path, erofs_off_t chunksize)
 		blobfile = erofs_tmpfile();
 		multidev = false;
 	} else {
-		blobfile = open(blobfile_path, O_WRONLY | O_BINARY);
+		blobfile = open(blobfile_path, O_WRONLY | O_CREAT |
+						O_TRUNC | O_BINARY, 0666);
 		multidev = true;
 	}
 	if (blobfile < 0)
-- 
2.43.5



More information about the Linux-erofs mailing list