summaryrefslogtreecommitdiffstats
path: root/sbin/quotacheck
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>1998-06-15 07:07:21 +0000
committercharnier <charnier@FreeBSD.org>1998-06-15 07:07:21 +0000
commit07d25baf9d301d4d3b992e1580348ad73ce0894d (patch)
treeffaf174e4a683dcae9a8359aefb9854eea4bdab4 /sbin/quotacheck
parent9d674a7e985bdb87f5fa37da111245b1e6f5f8f3 (diff)
downloadFreeBSD-src-07d25baf9d301d4d3b992e1580348ad73ce0894d.zip
FreeBSD-src-07d25baf9d301d4d3b992e1580348ad73ce0894d.tar.gz
Correct use of .Nm. Add rcsid. Remove unused #includes. Use err(3).
Diffstat (limited to 'sbin/quotacheck')
-rw-r--r--sbin/quotacheck/preen.c46
1 files changed, 20 insertions, 26 deletions
diff --git a/sbin/quotacheck/preen.c b/sbin/quotacheck/preen.c
index de9bb55..9705aee 100644
--- a/sbin/quotacheck/preen.c
+++ b/sbin/quotacheck/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);
}
OpenPOWER on IntegriCloud