mount: check if mtab is writable
Subsystems (2)
Quoted 11 lines · Guillaume Rousse
Signature · 9 lines
Guillaume Rousse Moyens Informatiques - INRIA Futurs Tel: 01 69 35 69 62 Signed-off-by: Christiaan Welvaart <[email protected]> -- --- nfs-utils-1.1.1/utils/mount/mount.c.bak 2007-10-19 05:07:28.000000000 +0200 +++ nfs-utils-1.1.1/utils/mount/mount.c 2007-12-12 20:27:45.054651566 +0100
Review line 400
Quoted 8 lines
(quoted diff) +1
-1@@ -394,7 +394,7 @@ if (!fake) print_one(spec, mount_point, fs_type, mount_opts); - if (!nomtab) + if (!nomtab && mtab_is_writable()) ret = add_mtab(spec, mount_point, fs_type, flags, *extra_opts, 0, 0 /* these are always zero for NFS */ ); return ret;
I think the result of this change would be that if the mtab isn't writable (for example, if it's a symlink to /proc/mounts) then add_mtab() wouldn't print an error message saying it couldn't write. That seems harmless enough.
Looking at the shared routine update_mtab(), the first thing it does is check if the mtab exists and is writable. That check should probably be copied to utils/mount/mount.c:add_mtab() instead of using this patch.
I might even advocate moving add_mtab to support/nfs/fstab.c.
--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com