Patch for mount util

Steven N. Hirsch (shirsch@ibm.net)
Sat, 31 Aug 1996 21:04:06 -0400


This is a multi-part message in MIME format.

--------------13D539171EE9CC0937E2B0A5
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Andries (and everyone),

I have just found and fixed an annoying bug in mount-2.5m (and most
recent versions). The offending code checks fstab, mtab and
/proc/filesystems searching for a device name or mount point given on
the command line. As originally coded, all three checks occur. Problem
is, any options obtained from fstab get zapped by the subsequent checks
and never get processed! I wondered why all attempts to mount my local
NFS server by using:

mount host:/ /mnt

resulted in (noexec,nosuid...) regardless of what appeared in the
options field of fstab - even when invoked as root.

Anyway, applying a DeMorgan transformation to the logic results in
successive ORs. This short-circuits when the mount point is found in
fstab and correctly returns a pointer to the information structure.

Enjoy.

- Steve

--------------13D539171EE9CC0937E2B0A5
Content-Type: text/plain; charset=us-ascii; name="mount.c.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="mount.c.diff"

--- mount.c.orig Sat Jul 6 15:41:19 1996
+++ mount.c Sat Aug 31 20:42:48 1996
@@ -25,6 +25,7 @@
* Fri Feb 23 13:47:00 1996: aeb@cwi.nl, loop device related changes
*
* Fri Apr 5 01:13:33 1996: quinlan@bucknell.edu, fixed up iso9660 autodetect
+ * Sat Aug 31 20:40:00 1996: shirsch@ibm.net, fixed parsing of fstab options.
*/


@@ -942,8 +943,9 @@
usage (stderr, 1);
/* Try to find the other pathname in fstab. */
spec = canonicalize (*argv);
- if (!(fs = getmntfile (spec))
- && !(fs = getfsspec (spec)) && !(fs = getfsfile (spec)))
+ if (!( (fs = getmntfile (spec))
+ || (fs = getfsspec (spec))
+ || (fs = getfsfile (spec)) ))
die (2, "mount: can't find %s in %s or %s",
spec, MOUNTED, _PATH_FSTAB);
/* Merge the fstab and command line options. */

--------------13D539171EE9CC0937E2B0A5--