In section 31.3.2, "Mount, Unmount, Remount", the signature of the mount function is declared as: int mount (const char *special_file, const char *dir, const char *fstype, unsigned long int options, const void *data) Later in the documentation, the following examples are provided: Example: #include <sys/mount.h> mount("/dev/hdb", "/cdrom", MS_MGC_VAL | MS_RDONLY | MS_NOSUID, ""); mount("/dev/hda2", "/mnt", MS_MGC_VAL | MS_REMOUNT, ""); Both of these examples have the options flags as the 3rd parameter, with an empty string as the 4th. As these are MS_REMOUNT examples, it looks like the 4th parameter in the examples is meant to represent the filesystem type, so the 3rd and 4th parameters are the wrong way round.
More details: Contained in sysinfo.texi: This section: ---- @smallexample @group #include <sys/mount.h> mount("/dev/hdb", "/cdrom", MS_MGC_VAL | MS_RDONLY | MS_NOSUID, ""); mount("/dev/hda2", "/mnt", MS_MGC_VAL | MS_REMOUNT, ""); @end group @end smallexample ---- Probably needs to change to: ---- @smallexample @group #include <sys/mount.h> mount("/dev/hdb", "/cdrom", "", MS_MGC_VAL | MS_RDONLY | MS_NOSUID); mount("/dev/hda2", "/mnt", "", MS_MGC_VAL | MS_REMOUNT); @end group @end smallexample ----
I confirm this bug. However, since mount(2) is not variadic, the change should probably be: ---- @smallexample @group #include <sys/mount.h> mount("/dev/hdb", "/cdrom", "", MS_MGC_VAL | MS_RDONLY | MS_NOSUID, NULL); mount("/dev/hda2", "/mnt", "", MS_MGC_VAL | MS_REMOUNT, NULL); @end group @end smallexample ---- (That is, add the fifth argument in each call.)
Good call; that's correct!
Created attachment 13138 [details] Proposed patch to fix it