sload.f2fs: handle root mount point properly when setting file attribute
PATCH 1/1 sload.f2fs: handle root mount point properly when setting file attribute
From: Daeho Jeong <[email protected]>
Need to remove "/" of mount point name from the file path name when mount point is "/". Otherwise, we will transfer file path name whose first two characters are like "//" to fs_config function.
Signed-off-by Daeho Jeong <[email protected]>
--- fsck/sload.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
fsck/sload.c +10 -2
@@ -104,10 +104,18 @@ static int set_perms_and_caps(struct dentry *de)uint64_t capabilities =0 ;unsigned int uid =0 , gid =0 , imode =0 ;char *mnt_path =NULL ; +char *mount_path = c.mount_point; -if (asprintf (&mnt_path,"%s%s" , c.mount_point, de->path) <=0 ) { +/* +* de->path already has "/" in the beginning of it. +* Need to remove "/" when c.mount_point is "/", not to add it twice. +*/ +if (strlen (c.mount_point) ==1 && c.mount_point[0 ] =='/' ) + mount_path ="" ; + +if (asprintf (&mnt_path,"%s%s" , mount_path, de->path) <=0 ) {ERR_MSG ("cannot allocate mount path for %s%s\n" , - c.mount_point, de->path); + mount_path, de->path);return -ENOMEM ; }
Signature · 8 lines
2.28.0.220.ged08abb693-goog _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 7 lines · Daeho Jeong
From: Daeho Jeong <[email protected]>
Need to remove "/" of mount point name from the file path name when mount point is "/". Otherwise, we will transfer file path name whose first two characters are like "//" to
fs_configfunction.Signed-off-by Daeho Jeong <[email protected]>
Reviewed-by Chao Yu <[email protected]>
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel