summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ffs/utilities.c
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2001-04-24 22:38:08 +0000
committermckusick <mckusick@FreeBSD.org>2001-04-24 22:38:08 +0000
commitecbf3eacd9a17a3a9b238e2fa65b2d33d85e8d1f (patch)
tree261472238f24e110d11cd5bf7fc8de94dc83e882 /sbin/fsck_ffs/utilities.c
parentb92d41b0e964c6163071505bd9fdc9f02b6410fe (diff)
downloadFreeBSD-src-ecbf3eacd9a17a3a9b238e2fa65b2d33d85e8d1f.zip
FreeBSD-src-ecbf3eacd9a17a3a9b238e2fa65b2d33d85e8d1f.tar.gz
Add support for the -F flag which determines whether a specified
filesystem needs foreground checking (usually at boot time) or can defer to background checking (after the system is up and running). See the manual page, fsck_ffs(8), for details on the -F and -B options. These options are primarily intended for use by the fsck front end. All output is directed to stdout so that the output is coherent when redirected to a file or a pipe. Unify the code with the fsck front end that allows either a device or a mount point to be specified as the argument to be checked.
Diffstat (limited to 'sbin/fsck_ffs/utilities.c')
-rw-r--r--sbin/fsck_ffs/utilities.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sbin/fsck_ffs/utilities.c b/sbin/fsck_ffs/utilities.c
index 81b96e6..e584c8f 100644
--- a/sbin/fsck_ffs/utilities.c
+++ b/sbin/fsck_ffs/utilities.c
@@ -52,6 +52,7 @@ static const char rcsid[] =
#include <string.h>
#include <ctype.h>
#include <fstab.h>
+#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -64,11 +65,20 @@ blockcheck(origname)
char *origname;
{
struct stat stslash, stblock, stchar;
- char *newname, *raw;
+ char *newname, *raw, *cp;
struct fstab *fsinfo;
int retried = 0, len;
+ static char device[MAXPATHLEN];
newname = origname;
+ if (stat(newname, &stblock) < 0) {
+ cp = strrchr(newname, '/');
+ if (cp == 0) {
+ (void)snprintf(device, sizeof(device), "%s%s",
+ _PATH_DEV, newname);
+ newname = device;
+ }
+ }
retry:
if (stat(newname, &stblock) < 0) {
printf("Can't stat %s: %s\n", newname, strerror(errno));
@@ -90,7 +100,7 @@ retry:
printf(
"Can't resolve %s to character special device.\n",
origname);
- return (0);
+ return (origname);
}
newname = fsinfo->fs_spec;
retried++;
OpenPOWER on IntegriCloud