diff --git a/sbin/fsck/preen.c b/sbin/fsck/preen.c index 413e4d4ff594..a35182e273f0 100644 --- a/sbin/fsck/preen.c +++ b/sbin/fsck/preen.c @@ -45,6 +45,7 @@ static const char sccsid[] = "@(#)preen.c 8.1 (Berkeley) 6/5/93"; #include #include #include +#include #include "fsck.h" struct part { @@ -292,7 +293,8 @@ blockcheck(name) { struct stat stslash, stblock, stchar; char *raw; - int retried = 0; + struct fstab *fsinfo; + int retried = 0, l; hotroot = 0; if (stat("/", &stslash) < 0) { @@ -325,6 +327,19 @@ blockcheck(name) name = unrawname(name); retried++; goto retry; + } else if ((stblock.st_mode & S_IFMT) == S_IFDIR && !retried) { + l = strlen(name) - 1; + if (l > 0 && name[l] == '/') + /* remove trailing slash */ + name[l] = '\0'; + if(!(fsinfo=getfsfile(name))) { + printf("Can't resolve %s to character special device", + name); + return (0); + } + name = fsinfo->fs_spec; + retried++; + goto retry; } printf("Can't make sense out of name %s\n", name); return (0); diff --git a/sbin/fsck_ffs/preen.c b/sbin/fsck_ffs/preen.c index 413e4d4ff594..a35182e273f0 100644 --- a/sbin/fsck_ffs/preen.c +++ b/sbin/fsck_ffs/preen.c @@ -45,6 +45,7 @@ static const char sccsid[] = "@(#)preen.c 8.1 (Berkeley) 6/5/93"; #include #include #include +#include #include "fsck.h" struct part { @@ -292,7 +293,8 @@ blockcheck(name) { struct stat stslash, stblock, stchar; char *raw; - int retried = 0; + struct fstab *fsinfo; + int retried = 0, l; hotroot = 0; if (stat("/", &stslash) < 0) { @@ -325,6 +327,19 @@ blockcheck(name) name = unrawname(name); retried++; goto retry; + } else if ((stblock.st_mode & S_IFMT) == S_IFDIR && !retried) { + l = strlen(name) - 1; + if (l > 0 && name[l] == '/') + /* remove trailing slash */ + name[l] = '\0'; + if(!(fsinfo=getfsfile(name))) { + printf("Can't resolve %s to character special device", + name); + return (0); + } + name = fsinfo->fs_spec; + retried++; + goto retry; } printf("Can't make sense out of name %s\n", name); return (0); diff --git a/sbin/fsck_ifs/preen.c b/sbin/fsck_ifs/preen.c index 413e4d4ff594..a35182e273f0 100644 --- a/sbin/fsck_ifs/preen.c +++ b/sbin/fsck_ifs/preen.c @@ -45,6 +45,7 @@ static const char sccsid[] = "@(#)preen.c 8.1 (Berkeley) 6/5/93"; #include #include #include +#include #include "fsck.h" struct part { @@ -292,7 +293,8 @@ blockcheck(name) { struct stat stslash, stblock, stchar; char *raw; - int retried = 0; + struct fstab *fsinfo; + int retried = 0, l; hotroot = 0; if (stat("/", &stslash) < 0) { @@ -325,6 +327,19 @@ blockcheck(name) name = unrawname(name); retried++; goto retry; + } else if ((stblock.st_mode & S_IFMT) == S_IFDIR && !retried) { + l = strlen(name) - 1; + if (l > 0 && name[l] == '/') + /* remove trailing slash */ + name[l] = '\0'; + if(!(fsinfo=getfsfile(name))) { + printf("Can't resolve %s to character special device", + name); + return (0); + } + name = fsinfo->fs_spec; + retried++; + goto retry; } printf("Can't make sense out of name %s\n", name); return (0); diff --git a/sbin/quotacheck/preen.c b/sbin/quotacheck/preen.c index 413e4d4ff594..a35182e273f0 100644 --- a/sbin/quotacheck/preen.c +++ b/sbin/quotacheck/preen.c @@ -45,6 +45,7 @@ static const char sccsid[] = "@(#)preen.c 8.1 (Berkeley) 6/5/93"; #include #include #include +#include #include "fsck.h" struct part { @@ -292,7 +293,8 @@ blockcheck(name) { struct stat stslash, stblock, stchar; char *raw; - int retried = 0; + struct fstab *fsinfo; + int retried = 0, l; hotroot = 0; if (stat("/", &stslash) < 0) { @@ -325,6 +327,19 @@ blockcheck(name) name = unrawname(name); retried++; goto retry; + } else if ((stblock.st_mode & S_IFMT) == S_IFDIR && !retried) { + l = strlen(name) - 1; + if (l > 0 && name[l] == '/') + /* remove trailing slash */ + name[l] = '\0'; + if(!(fsinfo=getfsfile(name))) { + printf("Can't resolve %s to character special device", + name); + return (0); + } + name = fsinfo->fs_spec; + retried++; + goto retry; } printf("Can't make sense out of name %s\n", name); return (0);