summaryrefslogtreecommitdiffstats
path: root/sbin/fsck/preen.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1999-11-27 20:02:27 +0000
committerphk <phk@FreeBSD.org>1999-11-27 20:02:27 +0000
commit44eb44a9e89f713e7927093b25547d6532b4b728 (patch)
tree31508c495c89229d2593305b119b325ce4b6716c /sbin/fsck/preen.c
parent9fc872877e2cdc38e087f03f84b5fd16fa9fe726 (diff)
downloadFreeBSD-src-44eb44a9e89f713e7927093b25547d6532b4b728.zip
FreeBSD-src-44eb44a9e89f713e7927093b25547d6532b4b728.tar.gz
Make fsck even more char/blk dev tolerant.
Diffstat (limited to 'sbin/fsck/preen.c')
-rw-r--r--sbin/fsck/preen.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/sbin/fsck/preen.c b/sbin/fsck/preen.c
index aedb592..fc6dd23 100644
--- a/sbin/fsck/preen.c
+++ b/sbin/fsck/preen.c
@@ -309,24 +309,16 @@ retry:
printf("Can't stat %s: %s\n", newname, strerror(errno));
return (origname);
}
- if ((stblock.st_mode & S_IFMT) == S_IFBLK ||
- (stblock.st_mode & S_IFMT) == S_IFCHR) {
+ switch(stblock.st_mode & S_IFMT) {
+ case S_IFCHR:
+ case S_IFBLK:
if (stslash.st_dev == stblock.st_rdev)
hotroot++;
- raw = newname;
- if (stat(raw, &stchar) < 0) {
- printf("Can't stat %s: %s\n", raw, strerror(errno));
- return (origname);
- }
- if ((stchar.st_mode & S_IFMT) == S_IFCHR) {
- if (stslash.st_dev == stchar.st_rdev)
- hotroot++;
- return (raw);
- } else {
- printf("%s is not a character device\n", raw);
- return (origname);
- }
- } else if ((stblock.st_mode & S_IFMT) == S_IFDIR && !retried) {
+ return(newname);
+ case S_IFDIR:
+ if (retried)
+ break;
+
len = strlen(origname) - 1;
if (len > 0 && origname[len] == '/')
/* remove trailing slash */
OpenPOWER on IntegriCloud