Hi Hongbo,

On 2025/4/27 10:49, Hongbo Li wrote:


On 2025/4/27 10:15, Gao Xiang wrote:
Create one if the file doesn't exist.

Fixes: b6b741d8daaf ("erofs-utils: lib: get rid of tmpfile()")

I think the real fixes should be Fixes: bbeec3c93076 ("erofs-utils: mkfs: add extra 
blob device support").

Prior to b6b741d8daaf, the functionality is ok since
fopen(..,"wb") will create the file too.

Signed-off-by: Gao Xiang <hsiang...@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);
To maintain consistency, is it better to set the default permission to 0644?

I tend to switch all modes to 0666 around the codebase
in the future, since umask(022) will mask them into 0644.

Thanks,
Gao Xiang

Reply via email to