+2005-02-10 Miklos Szeredi <miklos@szeredi.hu>
+
+ * fusermount: set umask, otherwise /etc/mtab will have
+ unpredictable permission. Spotted by Jindrich Kolorenc
+
+ * fusermount: set owner and group of /etc/mtab to original values
+ on unmount
+
2005-02-07 Miklos Szeredi <miklos@szeredi.hu>
* Cleaned up directory reading (temporary file is not used)
const char *mtab, const char *mtab_new)
{
int res;
+ struct stat sbuf;
if (getuid() != 0) {
res = drop_privs();
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,
if (getuid() != 0)
restore_privs();
+ umask(033);
if (unmount) {
if (geteuid() == 0) {
int mtablock = lock_mtab();