[PATCH] AOSP: erofs-utils: fix sub directory prefix path in canned fs_config

Gao Xiang hsiangkao at redhat.com
Tue Dec 22 21:47:00 AEDT 2020


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 :(

Thanks,
Gao Xiang

> 
> Thx.



More information about the Linux-erofs mailing list