From: David van Moolenbroek Date: Tue, 3 Aug 2010 13:46:00 +0000 (+0000) Subject: mount: don't always autodetect X-Git-Tag: v3.1.8~110 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/host.html?a=commitdiff_plain;h=256c37f7fae7c69639032eba7cfc670115adaf8f;p=minix.git mount: don't always autodetect --- diff --git a/commands/mount/mount.c b/commands/mount/mount.c index 0d6060b2f..305cb78a9 100644 --- a/commands/mount/mount.c +++ b/commands/mount/mount.c @@ -26,7 +26,7 @@ int main(argc, argv) int argc; char *argv[]; { - int i, n, v, mountflags; + int i, n, v = 0, mountflags; char **ap, *vs, *opt, *err, *type, *args, *device; char special[PATH_MAX+1], mounted_on[PATH_MAX+1], version[10], rw_flag[10]; @@ -61,13 +61,13 @@ char *argv[]; device = argv[1]; if (!strcmp(device, "none")) device = NULL; - /* auto-detect type */ - v = fsversion(argv[1], "mount"); - if (type == NULL) { + if ((type == NULL || !strcmp(type, MINIX_FS_TYPE)) && device != NULL) { + /* auto-detect type and/or version */ + v = fsversion(device, "mount"); switch (v) { case FSVERSION_MFS1: case FSVERSION_MFS2: - case FSVERSION_MFS3: type = "mfs"; break; + case FSVERSION_MFS3: type = MINIX_FS_TYPE; break; case FSVERSION_EXT2: type = "ext2"; break; } } @@ -98,7 +98,7 @@ char *argv[]; } } /* For MFS, use a version number. Otherwise, use the FS type name. */ - if (type == NULL || !strcmp(type, MINIX_FS_TYPE)) { + if (!strcmp(type, MINIX_FS_TYPE)) { switch (v) { case FSVERSION_MFS1: vs = "1"; break; case FSVERSION_MFS2: vs = "2"; break;