diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2006-07-30 17:33:40 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2006-07-30 17:33:40 +0000 |
commit | 9a5c11d132298239be66d7538c3f8c6b03f8ad95 (patch) | |
tree | e5a676b6f20f663d7574ca7a5ca9eda6e9ab6b8e /util | |
parent | 3b0e4faeaf38e234b8c1209ec92824691503995f (diff) |
fixes
Diffstat (limited to 'util')
-rw-r--r-- | util/fusermount.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/util/fusermount.c b/util/fusermount.c index 4a3c264..6d3ef97 100644 --- a/util/fusermount.c +++ b/util/fusermount.c @@ -39,6 +39,10 @@ #include <sys/utsname.h> #include <sys/sysmacros.h> +#ifdef HAVE_SELINUX_SELINUX_H +#include <selinux/selinux.h> +#endif + #define FUSE_COMMFD_ENV "_FUSE_COMMFD" #define FUSE_DEV_OLD "/proc/fs/fuse/dev" @@ -185,6 +189,18 @@ static int unmount_rename(const char *mtab, const char *mtab_new) if (stat(mtab, &sbuf) == 0) chown(mtab_new, sbuf.st_uid, sbuf.st_gid); +#ifdef HAVE_LIBSELINUX + { + security_context_t filecon; + + if (getfilecon(mtab, &filecon) > 0) { + setfilecon(mtab_new, filecon); + if (filecon != NULL) + freecon(filecon); + } + } +#endif + res = rename(mtab_new, mtab); if (res == -1) { fprintf(stderr, "%s: failed to rename %s to %s: %s\n", progname, |