* 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.
//
#endif
llist_t *fslist;
char getmntent_buf[1];
-
} FIX_ALIASING;
enum { GETMNTENT_BUFSIZE = COMMON_BUFSIZE - offsetof(struct globals, getmntent_buf) };
#define G (*(struct globals*)&bb_common_bufsiz1)
args[rc++] = filteropts;
}
args[rc] = NULL;
- rc = wait4pid(spawn(args));
+ rc = spawn_and_wait(args);
free(args[0]);
if (!rc)
break;
* 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.
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
bb_herror_msg("%s", hostname);
goto fail;
}
- if ((size_t)hp->h_length > sizeof(struct in_addr)) {
- bb_error_msg("got bad hp->h_length");
- hp->h_length = sizeof(struct in_addr);
+ if (hp->h_length != (int)sizeof(struct in_addr)) {
+ bb_error_msg_and_die("only IPv4 is supported");
}
- memcpy(&server_addr.sin_addr,
- hp->h_addr, hp->h_length);
+ memcpy(&server_addr.sin_addr, hp->h_addr_list[0], sizeof(struct in_addr));
}
memcpy(&mount_server_addr, &server_addr, sizeof(mount_server_addr));
continue;
}
- val = xatoi_u(opteq);
+ val = xatoi_positive(opteq);
switch (idx) {
case 0: // "rsize"
data.rsize = val;
bb_herror_msg("%s", mounthost);
goto fail;
}
- if ((size_t)hp->h_length > sizeof(struct in_addr)) {
- bb_error_msg("got bad hp->h_length");
- hp->h_length = sizeof(struct in_addr);
+ if (hp->h_length != (int)sizeof(struct in_addr)) {
+ bb_error_msg_and_die("only IPv4 is supported");
}
mount_server_addr.sin_family = AF_INET;
- memcpy(&mount_server_addr.sin_addr,
- hp->h_addr, hp->h_length);
+ memcpy(&mount_server_addr.sin_addr, hp->h_addr_list[0], sizeof(struct in_addr));
}
}
}
args[n++] = mp->mnt_dir;
args[n] = NULL;
- rc = wait4pid(xspawn(args));
+ rc = spawn_and_wait(args);
goto report_error;
}
// 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
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;
}
}
fstab = setmntent(fstabname, "r");
if (!fstab)
- bb_perror_msg_and_die("can't read %s", fstabname);
+ bb_perror_msg_and_die("can't read '%s'", fstabname);
// Loop through entries until we find what we're looking for
memset(mtpair, 0, sizeof(mtpair));