hush: rename o_quoted to has_quoted_part; small code shrink
[oweals/busybox.git] / util-linux / mount.c
index 8ec3071b19f2e2bc962a51c4187d0cb5f2759598..5e85f998641c473ef5f4e66c42dc394b245adc80 100644 (file)
@@ -6,7 +6,7 @@
  * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
  * Copyright (C) 2005-2006 by Rob Landley <rob@landley.net>
  *
- * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
  */
 // Design notes: There is no spec for mount.  Remind me to write one.
 //
@@ -532,7 +532,7 @@ static int mount_it_now(struct mntent *mp, long vfsflags, char *filteropts)
  * Linux NFS mount
  * Copyright (C) 1993 Rick Sladkey <jrs@world.std.com>
  *
- * Licensed under GPLv2, see file LICENSE in this tarball for details.
+ * Licensed under GPLv2, see file LICENSE in this source tree.
  *
  * Wed Feb  8 12:51:48 1995, biro@yggdrasil.com (Ross Biro): allow all port
  * numbers to be specified on the command line.
@@ -749,7 +749,15 @@ static const uint8_t nfs_err_stat[] = {
        19, 20, 21, 22, 27, 28,
        30, 63, 66, 69, 70, 71
 };
-static const uint8_t nfs_err_errnum[] = {
+#if ( \
+       EPERM | ENOENT      | EIO      | ENXIO | EACCES| EEXIST | \
+       ENODEV| ENOTDIR     | EISDIR   | EINVAL| EFBIG | ENOSPC | \
+       EROFS | ENAMETOOLONG| ENOTEMPTY| EDQUOT| ESTALE| EREMOTE) < 256
+typedef uint8_t nfs_err_type;
+#else
+typedef uint16_t nfs_err_type;
+#endif
+static const nfs_err_type nfs_err_errnum[] = {
        EPERM , ENOENT      , EIO      , ENXIO , EACCES, EEXIST,
        ENODEV, ENOTDIR     , EISDIR   , EINVAL, EFBIG , ENOSPC,
        EROFS , ENAMETOOLONG, ENOTEMPTY, EDQUOT, ESTALE, EREMOTE
@@ -1139,7 +1147,7 @@ static NOINLINE int nfsmount(struct mntent *mp, long vfsflags, char *filteropts)
                                continue;
                        }
 
-                       val = xatoi_u(opteq);
+                       val = xatoi_positive(opteq);
                        switch (idx) {
                        case 0: // "rsize"
                                data.rsize = val;
@@ -1710,9 +1718,9 @@ static int singlemount(struct mntent *mp, int ignore_busy)
 
        // If we know the fstype (or don't need to), jump straight
        // to the actual mount.
-       if (mp->mnt_type || (vfsflags & (MS_REMOUNT | MS_BIND | MS_MOVE)))
+       if (mp->mnt_type || (vfsflags & (MS_REMOUNT | MS_BIND | MS_MOVE))) {
                rc = mount_it_now(mp, vfsflags, filteropts);
-       else {
+       else {
                // Loop through filesystem types until mount succeeds
                // or we run out
 
@@ -1748,7 +1756,7 @@ static int singlemount(struct mntent *mp, int ignore_busy)
 
        if (errno == EBUSY && ignore_busy)
                return 0;
-       if (rc < 0)
+       if (rc != 0)
                bb_perror_msg("mounting %s on %s failed", mp->mnt_fsname, mp->mnt_dir);
        return rc;
 }