aboutsummaryrefslogtreecommitdiff
path: root/sbin/fsck_ffs/preen.c
diff options
context:
space:
mode:
authorPhilippe Charnier <charnier@FreeBSD.org>1998-06-15 07:07:21 +0000
committerPhilippe Charnier <charnier@FreeBSD.org>1998-06-15 07:07:21 +0000
commit2d34272b7ba54e88b4cea45937b83ccfaa2d43b0 (patch)
treef17ed9811a9b9064c297c5c3d9487c1477b21733 /sbin/fsck_ffs/preen.c
parent8f034b11f2fd7621188a12b156dc6fe7008f50b2 (diff)
downloadsrc-2d34272b7ba54e88b4cea45937b83ccfaa2d43b0.tar.gz
src-2d34272b7ba54e88b4cea45937b83ccfaa2d43b0.zip
Correct use of .Nm. Add rcsid. Remove unused #includes. Use err(3).
Notes
Notes: svn path=/head/; revision=37000
Diffstat (limited to 'sbin/fsck_ffs/preen.c')
-rw-r--r--sbin/fsck_ffs/preen.c46
1 files changed, 20 insertions, 26 deletions
diff --git a/sbin/fsck_ffs/preen.c b/sbin/fsck_ffs/preen.c
index de9bb5598615..9705aeea9280 100644
--- a/sbin/fsck_ffs/preen.c
+++ b/sbin/fsck_ffs/preen.c
@@ -32,7 +32,11 @@
*/
#ifndef lint
+#if 0
static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95";
+#endif
+static const char rcsid[] =
+ "$Id$";
#endif /* not lint */
#include <sys/param.h>
@@ -42,6 +46,7 @@ static const char sccsid[] = "@(#)preen.c 8.5 (Berkeley) 4/28/95";
#include <ufs/ufs/dinode.h>
#include <ctype.h>
+#include <err.h>
#include <fstab.h>
#include <string.h>
@@ -88,8 +93,7 @@ checkfstab(preen, maxrun, docheck, chkit)
sumstatus = 0;
for (passno = 1; passno <= 2; passno++) {
if (setfsent() == 0) {
- fprintf(stderr, "Can't open checklist file: %s\n",
- _PATH_FSTAB);
+ warnx("can't open checklist file: %s", _PATH_FSTAB);
return (8);
}
while ((fsp = getfsent()) != 0) {
@@ -218,15 +222,11 @@ finddisk(name)
dk->name[len] == 0)
return (dk);
}
- if ((*dkp = (struct disk *)malloc(sizeof(struct disk))) == NULL) {
- fprintf(stderr, "out of memory");
- exit (8);
- }
+ if ((*dkp = (struct disk *)malloc(sizeof(struct disk))) == NULL)
+ errx(8, "out of memory");
dk = *dkp;
- if ((dk->name = malloc(len + 1)) == NULL) {
- fprintf(stderr, "out of memory");
- exit (8);
- }
+ if ((dk->name = malloc(len + 1)) == NULL)
+ errx(8, "out of memory");
(void)strncpy(dk->name, name, len);
dk->name[len] = '\0';
dk->part = NULL;
@@ -249,20 +249,14 @@ addpart(name, fsname, auxdata)
printf("%s in fstab more than once!\n", name);
return;
}
- if ((*ppt = (struct part *)malloc(sizeof(struct part))) == NULL) {
- fprintf(stderr, "out of memory");
- exit (8);
- }
+ if ((*ppt = (struct part *)malloc(sizeof(struct part))) == NULL)
+ errx(8, "out of memory");
pt = *ppt;
- if ((pt->name = malloc(strlen(name) + 1)) == NULL) {
- fprintf(stderr, "out of memory");
- exit (8);
- }
+ if ((pt->name = malloc(strlen(name) + 1)) == NULL)
+ errx(8, "out of memory");
(void)strcpy(pt->name, name);
- if ((pt->fsname = malloc(strlen(fsname) + 1)) == NULL) {
- fprintf(stderr, "out of memory");
- exit (8);
- }
+ if ((pt->fsname = malloc(strlen(fsname) + 1)) == NULL)
+ errx(8, "out of memory");
(void)strcpy(pt->fsname, fsname);
pt->next = NULL;
pt->auxdata = auxdata;
@@ -277,7 +271,7 @@ startdisk(dk, checkit)
dk->pid = fork();
if (dk->pid < 0) {
- perror("fork");
+ warn("fork");
return (8);
}
if (dk->pid == 0)
@@ -297,14 +291,14 @@ blockcheck(origname)
hotroot = 0;
if (stat("/", &stslash) < 0) {
- perror("/");
+ warn("/");
printf("Can't stat root\n");
return (origname);
}
newname = origname;
retry:
if (stat(newname, &stblock) < 0) {
- perror(newname);
+ warn("%s", newname);
printf("Can't stat %s\n", newname);
return (origname);
}
@@ -313,7 +307,7 @@ retry:
hotroot++;
raw = rawname(newname);
if (stat(raw, &stchar) < 0) {
- perror(raw);
+ warn("%s", raw);
printf("Can't stat %s\n", raw);
return (origname);
}