From bb7c1ea0a0d7e4a0b26fe85fecfcbc498f89e18d Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Tue, 20 Jul 1999 08:50:54 +0000 Subject: [PATCH] Also check against chardevs when looking for root. --- sbin/fsck/preen.c | 4 +++- sbin/fsck_ffs/preen.c | 4 +++- sbin/fsck_ifs/preen.c | 4 +++- sbin/quotacheck/preen.c | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/sbin/fsck/preen.c b/sbin/fsck/preen.c index cc8bba6e1e6..ffae2c6de39 100644 --- a/sbin/fsck/preen.c +++ b/sbin/fsck/preen.c @@ -36,7 +36,7 @@ static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95"; #endif static const char rcsid[] = - "$Id: preen.c,v 1.9 1998/06/15 07:07:20 charnier Exp $"; + "$Id: preen.c,v 1.11 1998/12/03 02:41:11 julian Exp $"; #endif /* not lint */ #include @@ -320,6 +320,8 @@ retry: 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); diff --git a/sbin/fsck_ffs/preen.c b/sbin/fsck_ffs/preen.c index cc8bba6e1e6..ffae2c6de39 100644 --- a/sbin/fsck_ffs/preen.c +++ b/sbin/fsck_ffs/preen.c @@ -36,7 +36,7 @@ static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95"; #endif static const char rcsid[] = - "$Id: preen.c,v 1.9 1998/06/15 07:07:20 charnier Exp $"; + "$Id: preen.c,v 1.11 1998/12/03 02:41:11 julian Exp $"; #endif /* not lint */ #include @@ -320,6 +320,8 @@ retry: 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); diff --git a/sbin/fsck_ifs/preen.c b/sbin/fsck_ifs/preen.c index cc8bba6e1e6..ffae2c6de39 100644 --- a/sbin/fsck_ifs/preen.c +++ b/sbin/fsck_ifs/preen.c @@ -36,7 +36,7 @@ static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95"; #endif static const char rcsid[] = - "$Id: preen.c,v 1.9 1998/06/15 07:07:20 charnier Exp $"; + "$Id: preen.c,v 1.11 1998/12/03 02:41:11 julian Exp $"; #endif /* not lint */ #include @@ -320,6 +320,8 @@ retry: 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); diff --git a/sbin/quotacheck/preen.c b/sbin/quotacheck/preen.c index cc8bba6e1e6..ffae2c6de39 100644 --- a/sbin/quotacheck/preen.c +++ b/sbin/quotacheck/preen.c @@ -36,7 +36,7 @@ static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95"; #endif static const char rcsid[] = - "$Id: preen.c,v 1.9 1998/06/15 07:07:20 charnier Exp $"; + "$Id: preen.c,v 1.11 1998/12/03 02:41:11 julian Exp $"; #endif /* not lint */ #include @@ -320,6 +320,8 @@ retry: 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);