|
|
4a4073 |
From eed8b4e5f7635f67ac68be426ade7964086e8fa0 Mon Sep 17 00:00:00 2001
|
|
|
4a4073 |
From: Christophe Dumez <christophe.dumez@intel.com>
|
|
|
4a4073 |
Date: Sun, 29 May 2011 17:23:53 +0300
|
|
|
4a4073 |
Subject: [PATCH] Do not update mtab if it is a symlink
|
|
|
4a4073 |
|
|
|
4a4073 |
mount.ecryptfs_private: Do not attempt to update
|
|
|
4a4073 |
mtab if it is a symbolic link.
|
|
|
4a4073 |
---
|
|
|
4a4073 |
src/utils/mount.ecryptfs_private.c | 11 ++++++++++-
|
|
|
4a4073 |
1 files changed, 10 insertions(+), 1 deletions(-)
|
|
|
4a4073 |
|
|
|
4a4073 |
diff --git a/src/utils/mount.ecryptfs_private.c b/src/utils/mount.ecryptfs_private.c
|
|
|
4a4073 |
index c19fa84..0fa02e6 100644
|
|
|
4a4073 |
--- a/src/utils/mount.ecryptfs_private.c
|
|
|
4a4073 |
+++ b/src/utils/mount.ecryptfs_private.c
|
|
|
4a4073 |
@@ -264,9 +264,18 @@ int is_mounted(char *dev, char *mnt, char *sig, int mounting) {
|
|
|
4a4073 |
|
|
|
4a4073 |
|
|
|
4a4073 |
int update_mtab(char *dev, char *mnt, char *opt) {
|
|
|
4a4073 |
-/* Update /etc/mtab with new mount entry.
|
|
|
4a4073 |
+/* Update /etc/mtab with new mount entry unless it is a symbolic link
|
|
|
4a4073 |
* Return 0 on success, 1 on failure.
|
|
|
4a4073 |
*/
|
|
|
4a4073 |
+ char dummy;
|
|
|
4a4073 |
+ int useMtab;
|
|
|
4a4073 |
+ /* Check if mtab is a symlink */
|
|
|
4a4073 |
+ useMtab = (readlink("/etc/mtab", &dummy, 1) < 0);
|
|
|
4a4073 |
+ if (!useMtab) {
|
|
|
4a4073 |
+ /* No need updating mtab */
|
|
|
4a4073 |
+ return 0;
|
|
|
4a4073 |
+ }
|
|
|
4a4073 |
+
|
|
|
4a4073 |
FILE *fh;
|
|
|
4a4073 |
struct mntent m;
|
|
|
4a4073 |
fh = setmntent("/etc/mtab", "a");
|
|
|
4a4073 |
--
|
|
|
4a4073 |
1.7.5.2
|
|
|
4a4073 |
|
|
|
4a4073 |
|