+
+ if (all == TRUE || directory == NULL) {
+ struct mntent *m;
+ FILE *f = setmntent("/etc/fstab", "r");
+ fstabmount = TRUE;
+
+ if (f == NULL)
+ perror_msg_and_die( "\nCannot read /etc/fstab");
+
+ while ((m = getmntent(f)) != NULL) {
+ if (all == FALSE && directory == NULL && (
+ (strcmp(device, m->mnt_fsname) != 0) &&
+ (strcmp(device, m->mnt_dir) != 0) ) ) {
+ continue;
+ }
+
+ if (all == TRUE && ( // If we're mounting 'all'
+ (strstr(m->mnt_opts, "noauto")) || // and the file system isn't noauto,
+ (strstr(m->mnt_type, "swap")) || // and isn't swap or nfs, then mount it
+ (strstr(m->mnt_type, "nfs")) ) ) {
+ continue;
+ }
+
+ if (all == TRUE || flags == 0) { // Allow single mount to override fstab flags
+ flags = 0;
+ *string_flags = '\0';
+ parse_mount_options(m->mnt_opts, &flags, string_flags);
+ }
+
+ device = strdup(m->mnt_fsname);
+ directory = strdup(m->mnt_dir);
+ filesystemType = strdup(m->mnt_type);
+ string_flags = strdup(string_flags);
+singlemount:
+ rc = EXIT_SUCCESS;
+#ifdef BB_NFSMOUNT
+ if (strchr(device, ':') != NULL)
+ filesystemType = "nfs";
+ if (strcmp(filesystemType, "nfs") == 0) {
+ if (nfsmount (device, directory, &flags, &extra_opts,
+ &string_flags, 1)) {
+ perror_msg("nfsmount failed");
+ rc = EXIT_FAILURE;
+ }
+ }
+#endif
+ if (!mount_one(device, directory, filesystemType, flags,
+ string_flags, useMtab, fakeIt, extra_opts, TRUE))
+ rc = EXIT_FAILURE;
+
+ if (all == FALSE)
+ break;
+ }
+ if (fstabmount == TRUE)
+ endmntent(f);
+
+ if (all == FALSE && fstabmount == TRUE && directory == NULL)
+ fprintf(stderr, "Can't find %s in /etc/fstab\n", device);
+
+ return rc;