From 9a5c11d132298239be66d7538c3f8c6b03f8ad95 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Sun, 30 Jul 2006 17:33:40 +0000 Subject: fixes --- util/fusermount.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'util/fusermount.c') 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 #include +#ifdef HAVE_SELINUX_SELINUX_H +#include +#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, -- cgit v1.2.3