aboutsummaryrefslogtreecommitdiff
path: root/util/fusermount.c
diff options
context:
space:
mode:
authorGravatar Miklos Szeredi <miklos@szeredi.hu>2005-02-10 07:35:05 +0000
committerGravatar Miklos Szeredi <miklos@szeredi.hu>2005-02-10 07:35:05 +0000
commita71694156750f34959d65e2085794509a067df15 (patch)
treee26409c61d6fe54db7148077710b904e1f2f5f9e /util/fusermount.c
parentfbb5c74c232cddfeeee113456427f079ad06bece (diff)
fix
Diffstat (limited to 'util/fusermount.c')
-rw-r--r--util/fusermount.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/util/fusermount.c b/util/fusermount.c
index 4f9ed2f..1b79446 100644
--- a/util/fusermount.c
+++ b/util/fusermount.c
@@ -240,6 +240,7 @@ static int unmount_rename(const char *mnt, int quiet, int lazy,
const char *mtab, const char *mtab_new)
{
int res;
+ struct stat sbuf;
if (getuid() != 0) {
res = drop_privs();
@@ -253,6 +254,9 @@ static int unmount_rename(const char *mnt, int quiet, int lazy,
if (getuid() != 0)
restore_privs();
+ if (stat(mtab, &sbuf) == 0)
+ chown(mtab_new, sbuf.st_uid, sbuf.st_gid);
+
res = rename(mtab_new, mtab);
if (res == -1) {
fprintf(stderr, "%s: failed to rename %s to %s: %s\n", progname,
@@ -1046,6 +1050,7 @@ int main(int argc, char *argv[])
if (getuid() != 0)
restore_privs();
+ umask(033);
if (unmount) {
if (geteuid() == 0) {
int mtablock = lock_mtab();