// Use the mount_options list to parse options into flags.
// Also update list of unrecognized options if unrecognized != NULL
-static long parse_mount_options(char *options, char **unrecognized)
+static unsigned long parse_mount_options(char *options, char **unrecognized)
{
- long flags = MS_SILENT;
+ unsigned long flags = MS_SILENT;
// Loop through options
for (;;) {
// Find this option in mount_options
for (i = 0; i < ARRAY_SIZE(mount_options); i++) {
if (strcasecmp(option_str, options) == 0) {
- long fl = mount_options[i];
+ unsigned long fl = mount_options[i];
if (fl < 0)
flags &= fl;
else
// Perform actual mount of specific filesystem at specific location.
// NB: mp->xxx fields may be trashed on exit
-static int mount_it_now(struct mntent *mp, long vfsflags, char *filteropts)
+static int mount_it_now(struct mntent *mp, unsigned long vfsflags, char *filteropts)
{
int rc = 0;
}
/* NB: mp->xxx fields may be trashed on exit */
-static NOINLINE int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
+static NOINLINE int nfsmount(struct mntent *mp, unsigned long vfsflags, char *filteropts)
{
CLIENT *mclient;
char *hostname;
* For older kernels, you must build busybox with ENABLE_FEATURE_MOUNT_NFS.
* (However, note that then you lose any chances that NFS over IPv6 would work).
*/
-static int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
+static int nfsmount(struct mntent *mp, unsigned long vfsflags, char *filteropts)
{
len_and_sockaddr *lsa;
char *opts;
static int singlemount(struct mntent *mp, int ignore_busy)
{
int rc = -1;
- long vfsflags;
+ unsigned long vfsflags;
char *loopFile = NULL, *filteropts = NULL;
llist_t *fl = NULL;
struct stat st;
if (ENABLE_FEATURE_MOUNT_LOOP && S_ISREG(st.st_mode)) {
loopFile = bb_simplify_path(mp->mnt_fsname);
mp->mnt_fsname = NULL; // will receive malloced loop dev name
- if (set_loop(&mp->mnt_fsname, loopFile, 0, /*ro:*/ 0) < 0) {
+ if (set_loop(&mp->mnt_fsname, loopFile, 0, /*ro:*/ (vfsflags & MS_RDONLY)) < 0) {
if (errno == EPERM || errno == EACCES)
bb_error_msg(bb_msg_perm_denied_are_you_root);
else
FILE *fstab;
int i, j;
int rc = EXIT_SUCCESS;
+ unsigned long cmdopt_flags;
unsigned opt;
struct mntent mtpair[2], *mtcur = mtpair;
IF_NOT_DESKTOP(const int nonroot = 0;)
// Past this point, we are handling either "mount -a [opts]"
// or "mount [opts] single_param"
- i = parse_mount_options(cmdopts, NULL); // FIXME: should be "long", not "int"
- if (nonroot && (i & ~MS_SILENT)) // Non-root users cannot specify flags
+ cmdopt_flags = parse_mount_options(cmdopts, NULL);
+ if (nonroot && (cmdopt_flags & ~MS_SILENT)) // Non-root users cannot specify flags
bb_error_msg_and_die(bb_msg_you_must_be_root);
// If we have a shared subtree flag, don't worry about fstab or mtab.
if (ENABLE_FEATURE_MOUNT_FLAGS
- && (i & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))
+ && (cmdopt_flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))
) {
// verbose_mount(source, target, type, flags, data)
- rc = verbose_mount("", argv[0], "", i, "");
+ rc = verbose_mount("", argv[0], "", cmdopt_flags, "");
if (rc)
bb_simple_perror_msg_and_die(argv[0]);
return rc;
// Open either fstab or mtab
fstabname = "/etc/fstab";
- if (i & MS_REMOUNT) {
+ if (cmdopt_flags & MS_REMOUNT) {
// WARNING. I am not sure this matches util-linux's
// behavior. It's possible util-linux does not
// take -o opts from mtab (takes only mount source).
// End of fstab/mtab is reached.
// Were we looking for something specific?
if (argv[0]) { // yes
- long l;
+ unsigned long l;
// If we didn't find anything, complain
if (!mtcur->mnt_fsname)