summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ifs
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1996-10-25 20:38:40 +0000
committerjoerg <joerg@FreeBSD.org>1996-10-25 20:38:40 +0000
commit9a3ddd97b64f0e0e4fb5a367e46c882dc3710523 (patch)
tree2ec7cc0f301299b07e1ec49793b0d1db91f235ca /sbin/fsck_ifs
parent96b7b01c6486264bc544e40746f952c2e2e9ad2f (diff)
downloadFreeBSD-src-9a3ddd97b64f0e0e4fb5a367e46c882dc3710523.zip
FreeBSD-src-9a3ddd97b64f0e0e4fb5a367e46c882dc3710523.tar.gz
Allow the specification of a mountpoint, and resolve it s disk device
using the fstab. Closes PR bin/129. Submitted by: jmg@nike.efn.org (John-Mark Gurney)
Diffstat (limited to 'sbin/fsck_ifs')
-rw-r--r--sbin/fsck_ifs/preen.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/sbin/fsck_ifs/preen.c b/sbin/fsck_ifs/preen.c
index 413e4d4..a35182e 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 <unistd.h>
#include <stdlib.h>
#include <ctype.h>
+#include <fstab.h>
#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 @@ retry:
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);
OpenPOWER on IntegriCloud