* [PATCH] mkreiserfs: set the owner of the root directory to the calling user
@ 2008-03-14 8:39 Ludwig Nussel
0 siblings, 0 replies; only message in thread
From: Ludwig Nussel @ 2008-03-14 8:39 UTC (permalink / raw)
To: reiserfs-devel
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 <ludwig.nussel@suse.de>
Acked-by: Jeff Mahoney <jeffm@suse.com>
Index: reiserfsprogs-3.6.19/reiserfscore/reiserfslib.c
===================================================================
--- reiserfsprogs-3.6.19.orig/reiserfscore/reiserfslib.c
+++ reiserfsprogs-3.6.19/reiserfscore/reiserfslib.c
@@ -1142,6 +1142,19 @@ int create_dir_sd (reiserfs_filsys_t * f
memset(&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);
--
(o_ Ludwig Nussel
//\
V_/_ http://www.suse.de/
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nuernberg)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-03-14 8:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-14 8:39 [PATCH] mkreiserfs: set the owner of the root directory to the calling user Ludwig Nussel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.