+ }
+
+ // When we have two arguments, the second is the directory and we can
+ // skip looking at fstab entirely. We can always abspath() the directory
+ // argument when we get it.
+
+ if (optind+2 == argc) {
+ mtpair->mnt_fsname = argv[optind];
+ mtpair->mnt_dir = argv[optind+1];
+ mtpair->mnt_type = fstype;
+ mtpair->mnt_opts = cmdopts;
+ rc = singlemount(mtpair, 0);
+ goto clean_up;
+ }
+
+ // If we have at least one argument, it's the storage location
+
+ if (optind < argc) storage_path = bb_simplify_path(argv[optind]);
+
+ // Open either fstab or mtab
+
+ if (parse_mount_options(cmdopts,0) & MS_REMOUNT)
+ fstabname = (char *)bb_path_mtab_file; // Again with the evil const.
+ else fstabname="/etc/fstab";
+
+ if (!(fstab=setmntent(fstabname,"r")))
+ bb_perror_msg_and_die("Cannot read %s",fstabname);
+
+ // Loop through entries until we find what we're looking for.
+
+ memset(mtpair,0,sizeof(mtpair));
+ for (;;) {
+ struct mntent *mtnext = mtpair + (mtcur==mtpair ? 1 : 0);
+
+ // Get next fstab entry
+
+ if (!getmntent_r(fstab, mtcur, bb_common_bufsiz1
+ + (mtcur==mtpair ? sizeof(bb_common_bufsiz1)/2 : 0),
+ sizeof(bb_common_bufsiz1)/2))
+ {
+ // Were we looking for something specific?
+
+ if (optind != argc) {
+
+ // If we didn't find anything, complain.