summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShirish Pargaonkar <shirishpargaonkar@gmail.com>2009-07-27 12:02:35 -0400
committerJeff Layton <jlayton@redhat.com>2009-07-27 12:02:35 -0400
commita869e4253a87f9a5e13dbe87b2799f8683d238d7 (patch)
treee91f8c443d7ce8d42fe5eff80897d75a210d0465
parentb676e63a520e644e2737b55a61244fa8df9a10dc (diff)
downloadsamba-a869e4253a87f9a5e13dbe87b2799f8683d238d7.tar.gz
samba-a869e4253a87f9a5e13dbe87b2799f8683d238d7.tar.bz2
samba-a869e4253a87f9a5e13dbe87b2799f8683d238d7.zip
umount.cifs: do not attempt to update /etc/mtab if it is symbolic link
If /etc/mtab is a symbolic link to e.g. /proc/mounts, do not update it. This is a fix for a bug reported in 4675 on samba bugzilla Signed-off-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
-rw-r--r--client/umount.cifs.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/client/umount.cifs.c b/client/umount.cifs.c
index 0005054467..35563c1150 100644
--- a/client/umount.cifs.c
+++ b/client/umount.cifs.c
@@ -146,9 +146,11 @@ static int remove_from_mtab(char * mountpoint)
FILE * org_fd;
FILE * new_fd;
struct mntent * mount_entry;
+ struct stat statbuf;
- /* Do we need to check if it is a symlink to e.g. /proc/mounts
- in which case we probably do not want to update it? */
+ /* If it is a symlink, e.g. to /proc/mounts, no need to update it. */
+ if ((lstat(MOUNTED, &statbuf) == 0) && (S_ISLNK(statbuf.st_mode)))
+ return 0;
/* Do we first need to check if it is writable? */
@@ -162,7 +164,6 @@ static int remove_from_mtab(char * mountpoint)
printf("attempting to remove from mtab\n");
org_fd = setmntent(MOUNTED, "r");
-
if(org_fd == NULL) {
printf("Can not open %s\n",MOUNTED);
unlock_mtab();