On Tue, 22 Dec 2020 18:47:00 +0800
Gao Xiang <[email protected]> wrote:

> On Tue, Dec 22, 2020 at 06:34:11PM +0800, Yue Hu wrote:
> 
> ...
> 
> > > 
> > > Hmmm... such design is quite strange for me....
> > > Could you try the following diff?
> > > 
> > > diff --git a/lib/inode.c b/lib/inode.c
> > > index 9469074..9af6179 100644
> > > --- a/lib/inode.c
> > > +++ b/lib/inode.c
> > > @@ -698,11 +698,14 @@ int erofs_droid_inode_fsconfig(struct erofs_inode 
> > > *inode,
> > >   /* filesystem_config does not preserve file type bits */
> > >   mode_t stat_file_type_mask = st->st_mode & S_IFMT;
> > >   unsigned int uid = 0, gid = 0, mode = 0;
> > > + bool alloced;
> > >   char *fspath;
> > >  
> > >   inode->capabilities = 0;
> > > - if (!cfg.mount_point)
> > > -         fspath = erofs_fspath(path);
> > > +
> > > + alloced = (cfg.mount_point && erofs_fspath(path)[0] != '\0');
> > > + if (!alloced)
> > > +         fspath = (char *)erofs_fspath(path);
> > >   else if (asprintf(&fspath, "%s/%s", cfg.mount_point,
> > >                     erofs_fspath(path)) <= 0)
> > >           return -ENOMEM;
> > > @@ -718,7 +721,7 @@ int erofs_droid_inode_fsconfig(struct erofs_inode 
> > > *inode,
> > >                     cfg.target_out_path,
> > >                     &uid, &gid, &mode, &inode->capabilities);
> > >  
> > > - if (cfg.mount_point)
> > > + if (alloced)
> > >           free(fspath);
> > >   st->st_uid = uid;
> > >   st->st_gid = gid;
> > > 
> > > if it works, will redo a formal patch then....  
> > 
> > Works for me for canned fs_config.  
> 
> Ok, if it also works fine for non-canned fs_config on your side,
> I will redo a formal patch later... sigh :(

Hi Xiang,

I just remove the "--fs-config-file" in my test enviroment, after that,
build and boot are all working fine. 

If canned fs_config never used by others before, i think it's a bug. 

Thx.

> 
> Thanks,
> Gao Xiang
> 
> > 
> > Thx.  
> 

Reply via email to