+
+ fp = setmntent(bb_path_mtab_file, "r");
+ if (!fp) {
+ if (opt & OPT_ALL)
+ bb_error_msg_and_die("cannot open %s", bb_path_mtab_file);
+ } else {
+ while (getmntent_r(fp, &me, path, sizeof(path))) {
+ /* Match fstype if passed */
+ if (fstype && match_fstype(&me, fstype))
+ continue;
+ m = xmalloc(sizeof(struct mtab_list));
+ m->next = mtl;
+ m->device = xstrdup(me.mnt_fsname);
+ m->dir = xstrdup(me.mnt_dir);
+ mtl = m;
+ }
+ endmntent(fp);
+ }
+
+ /* If we're not umounting all, we need at least one argument. */
+ if (!(opt & OPT_ALL) && !fstype) {
+ m = 0;
+ if (!argc) bb_show_usage();
+ }