]> err.no Git - util-linux/commitdiff
umount: only call update_mtab if mtab_is_writable().
authorLaMont Jones <lamont@mmjgroup.com>
Sun, 26 Aug 2007 02:27:42 +0000 (20:27 -0600)
committerLaMont Jones <lamont@mmjgroup.com>
Sun, 26 Aug 2007 02:27:42 +0000 (20:27 -0600)
There are several calls to update_mtab() which are not guarded by
mtab_is_writable().  Reported by: Daniel Jacobowitz <dan@debian.org>

See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=338803

Signed-off-by: LaMont Jones <lamont@mmjgroup.com>
mount/umount.c

index b3100c9a0bf616e8b6ca877df8c38e772e3dc8f1..01030051599c8ebf58d804b6f1f82b1291a6b935 100644 (file)
@@ -243,7 +243,7 @@ umount_one (const char *spec, const char *node, const char *type,
                        remnt.mnt_type = remnt.mnt_fsname = NULL;
                        remnt.mnt_dir = xstrdup(node);
                        remnt.mnt_opts = xstrdup("ro");
-                       if (!nomtab)
+                       if (!nomtab && mtab_is_writable())
                                update_mtab(node, &remnt);
                        return 0;
                } else if (errno != EBUSY) {    /* hmm ... */
@@ -297,7 +297,7 @@ umount_one (const char *spec, const char *node, const char *type,
                del_loop(loopdev);
 
  writemtab:
-       if (!nomtab &&
+       if (!nomtab && mtab_is_writable() &&
            (umnt_err == 0 || umnt_err == EINVAL || umnt_err == ENOENT)) {
                update_mtab (node, NULL);
        }