From: Ludwig Nussel <ludwig.nussel@suse.de>
To: reiserfs-devel@vger.kernel.org
Subject: [PATCH] mkreiserfs: set the owner of the root directory to the calling user
Date: Fri, 14 Mar 2008 09:39:37 +0100 [thread overview]
Message-ID: <20080314083937.GA3634@suse.de> (raw)
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)
reply other threads:[~2008-03-14 8:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080314083937.GA3634@suse.de \
--to=ludwig.nussel@suse.de \
--cc=reiserfs-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.