Skip to content

Commit

Permalink
Add "FUSE_NO_MTAB_UPDATE" env to disable mtab updates
Browse files Browse the repository at this point in the history
This adds the env FUSE_NO_MTAB_UPDATE variable to be able
to disable mtab updates without recompiling libfuse.
The value needs to be set to 1.
  • Loading branch information
bsbernd committed Mar 13, 2024
1 parent ec90f7b commit bdb8d57
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doc/mount.fuse3.8
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ The user can only mount on a mountpoint, for which it has write permission
The mountpoint is not a sticky directory which isn't owned by the user (like \fI/tmp\fP usually is)
.IP 3.
No other user (including root) can access the contents of the mounted filesystem.
.SH Environment variables
.TP
FUSE_NO_MTAB_UPDATE can be set to 1 to disable mtab (nowadays actually /run/mount/utab) updates.
.SH NOTE
FUSE filesystems are unmounted using the \fBfusermount3\fP(1) command (\fBfusermount3 -u mountpoint\fP).
.SH "AUTHORS"
Expand Down
7 changes: 7 additions & 0 deletions lib/mount_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ static int mtab_needs_update(const char *mnt)
int res;
struct stat stbuf;

char *env = getenv("FUSE_NO_MTAB_UPDATE");
if (env != NULL) {
int value = atoi(env);
if (value == 1)
return 0;
}

/* If mtab is within new mount, don't touch it */
if (strncmp(mnt, _PATH_MOUNTED, strlen(mnt)) == 0 &&
_PATH_MOUNTED[strlen(mnt)] == '/')
Expand Down

0 comments on commit bdb8d57

Please sign in to comment.