Make fsck even more char/blk dev tolerant.

This commit is contained in:
Poul-Henning Kamp 1999-11-27 20:02:27 +00:00
parent 5bb83b98db
commit ff180522d8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=53781
7 changed files with 41 additions and 70 deletions

View File

@ -309,24 +309,16 @@ blockcheck(origname)
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 */

View File

@ -87,8 +87,9 @@ setup(dev)
printf("Can't stat %s: %s\n", dev, strerror(errno));
return (0);
}
if ((statb.st_mode & S_IFMT) != S_IFCHR) {
pfatal("%s is not a character device", dev);
if ((statb.st_mode & S_IFMT) != S_IFCHR &&
(statb.st_mode & S_IFMT) != S_IFBLK) {
pfatal("%s is not a disk device", dev);
if (reply("CONTINUE") == 0)
return (0);
}

View File

@ -309,24 +309,16 @@ blockcheck(origname)
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 */

View File

@ -87,8 +87,9 @@ setup(dev)
printf("Can't stat %s: %s\n", dev, strerror(errno));
return (0);
}
if ((statb.st_mode & S_IFMT) != S_IFCHR) {
pfatal("%s is not a character device", dev);
if ((statb.st_mode & S_IFMT) != S_IFCHR &&
(statb.st_mode & S_IFMT) != S_IFBLK) {
pfatal("%s is not a disk device", dev);
if (reply("CONTINUE") == 0)
return (0);
}

View File

@ -309,24 +309,16 @@ blockcheck(origname)
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 */

View File

@ -87,8 +87,9 @@ setup(dev)
printf("Can't stat %s: %s\n", dev, strerror(errno));
return (0);
}
if ((statb.st_mode & S_IFMT) != S_IFCHR) {
pfatal("%s is not a character device", dev);
if ((statb.st_mode & S_IFMT) != S_IFCHR &&
(statb.st_mode & S_IFMT) != S_IFBLK) {
pfatal("%s is not a disk device", dev);
if (reply("CONTINUE") == 0)
return (0);
}

View File

@ -309,24 +309,16 @@ blockcheck(origname)
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 */