aboutsummaryrefslogtreecommitdiff
path: root/sbin/quotacheck/preen.c
diff options
context:
space:
mode:
authorJoerg Wunsch <joerg@FreeBSD.org>1996-10-25 20:38:40 +0000
committerJoerg Wunsch <joerg@FreeBSD.org>1996-10-25 20:38:40 +0000
commit2f77dcf6ad64eef00a3186e226d1f5aacef487ae (patch)
tree2ec7cc0f301299b07e1ec49793b0d1db91f235ca /sbin/quotacheck/preen.c
parent4f6653b93044330a0156bd43b8fc50b6b6a02ed4 (diff)
downloadsrc-2f77dcf6ad64eef00a3186e226d1f5aacef487ae.tar.gz
src-2f77dcf6ad64eef00a3186e226d1f5aacef487ae.zip
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)
Notes
Notes: svn path=/head/; revision=19185
Diffstat (limited to 'sbin/quotacheck/preen.c')
-rw-r--r--sbin/quotacheck/preen.c17
1 files changed, 16 insertions, 1 deletions
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 <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);