summaryrefslogtreecommitdiffstats
path: root/sbin/fsck
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/fsck')
-rw-r--r--sbin/fsck/fsck.84
-rw-r--r--sbin/fsck/preen.c17
2 files changed, 13 insertions, 8 deletions
diff --git a/sbin/fsck/fsck.8 b/sbin/fsck/fsck.8
index a358007..edef23e 100644
--- a/sbin/fsck/fsck.8
+++ b/sbin/fsck/fsck.8
@@ -65,9 +65,9 @@ Filesystems with pass number 1 (normally just the root filesystem)
are checked one at a time.
When pass 1 completes, all remaining filesystems are checked,
running one process per disk drive.
-The disk drive containing each filesystem is inferred from the longest prefix
+The disk drive containing each filesystem is inferred from the shortest prefix
of the device name that ends in a digit; the remaining characters are assumed
-to be the partition designator.
+to be the partition and slice designator.
.Pp
The options are as follows:
.Bl -tag -width indent
diff --git a/sbin/fsck/preen.c b/sbin/fsck/preen.c
index bd72d6b..e00e84e 100644
--- a/sbin/fsck/preen.c
+++ b/sbin/fsck/preen.c
@@ -259,12 +259,17 @@ finddisk(name)
size_t len = 0;
struct diskentry *d;
- for (len = strlen(name), p = name + len - 1; p >= name; --p)
- if (isdigit(*p)) {
- len = p - name + 1;
- break;
- }
- if (p < name)
+ p = strrchr(name, '/');
+ if (p == NULL)
+ p = name;
+ else
+ p++;
+ for (; *p && !isdigit(*p); p++)
+ continue;
+ for (; *p && isdigit(*p); p++)
+ continue;
+ len = p - name;
+ if (len == 0)
len = strlen(name);
TAILQ_FOREACH(d, &diskh, d_entries)
OpenPOWER on IntegriCloud