mkreiserfs: set the owner of the root directory to the calling user
PATCH 1/1 mkreiserfs: set the owner of the root directory to the calling user
Hi,
Following patch sets the owner of the root directory to the calling user.
This is also how mke2fs behaves. It enables users to e.g. create a file system on removeable storage devices and then be able to actually use them.
Signed-off-by Ludwig Nussel <[email protected]>
Acked-by Jeff Mahoney <[email protected]>
reiserfscore/reiserfslib.c +13 -0
@@ -1142,6 +1142,19 @@ int create_dir_sd (reiserfs_filsys_t * fmemset (&sd,0 ,sizeof (sd));make_dir_stat_data (fs->fs_blocksize, key_format,get_key_dirid (key),get_key_objectid (key), &ih, &sd); + +/* if calling user is not root set the owner of the root entry +* to the calling user */ +if (getuid ()) { +if (key_format ==KEY_FORMAT_1 ) { +struct stat_data_v1 *sd_v1 = (struct stat_data_v1 *)&sd; +set_sd_v1_uid (sd_v1,getuid ()); +set_sd_v1_gid (sd_v1,getgid ()); + }else { +set_sd_v2_uid (&sd,getuid ()); +set_sd_v2_gid (&sd,getgid ()); + } + }if (modify_item)modify_item (&ih, &sd);
Signature · 4 lines
(o_ Ludwig Nussel //\ V_/_ http://www.suse.de/ SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg)