summaryrefslogtreecommitdiffstats
path: root/sbin/fsck/fsutil.c
diff options
context:
space:
mode:
authoruqs <uqs@FreeBSD.org>2012-10-21 12:01:11 +0000
committeruqs <uqs@FreeBSD.org>2012-10-21 12:01:11 +0000
commitd704245c81126879f7dc17d84768dfe6451bbe9c (patch)
treeb2a97a49064cab03414a58504d6ca43ff136f9e0 /sbin/fsck/fsutil.c
parentd96edb4e587b89c3e877d08c245522e42d77a812 (diff)
downloadFreeBSD-src-d704245c81126879f7dc17d84768dfe6451bbe9c.zip
FreeBSD-src-d704245c81126879f7dc17d84768dfe6451bbe9c.tar.gz
sbin/fsck: s/perror/perr/ to avoid shadowing
- rename some other vars too - merge NetBSD license changes Obtained from: NetBSD PR: bin/139802 Reviewed by: ed
Diffstat (limited to 'sbin/fsck/fsutil.c')
-rw-r--r--sbin/fsck/fsutil.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/sbin/fsck/fsutil.c b/sbin/fsck/fsutil.c
index a4578bd..935992e 100644
--- a/sbin/fsck/fsutil.c
+++ b/sbin/fsck/fsutil.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fsutil.c,v 1.7 1998/07/30 17:41:03 thorpej Exp $ */
+/* $NetBSD: fsutil.c,v 1.15 2006/06/05 16:52:05 christos Exp $ */
/*
* Copyright (c) 1990, 1993
@@ -12,7 +12,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: fsutil.c,v 1.7 1998/07/30 17:41:03 thorpej Exp $");
+__RCSID("$NetBSD: fsutil.c,v 1.15 2006/06/05 16:52:05 christos Exp $");
#endif /* not lint */
__FBSDID("$FreeBSD$");
@@ -110,9 +110,13 @@ pwarn(const char *fmt, ...)
}
void
-perror(const char *s)
+perr(const char *fmt, ...)
{
- pfatal("%s (%s)", s, strerror(errno));
+ va_list ap;
+
+ va_start(ap, fmt);
+ vmsg(1, fmt, ap);
+ va_end(ap);
}
void
@@ -132,18 +136,15 @@ devcheck(const char *origname)
struct stat stslash, stchar;
if (stat("/", &stslash) < 0) {
- perror("/");
- printf("Can't stat root\n");
+ perr("Can't stat `/'");
return (origname);
}
if (stat(origname, &stchar) < 0) {
- perror(origname);
- printf("Can't stat %s\n", origname);
+ perr("Can't stat %s\n", origname);
return (origname);
}
if (!S_ISCHR(stchar.st_mode)) {
- perror(origname);
- printf("%s is not a char device\n", origname);
+ perr("%s is not a char device\n", origname);
}
return (origname);
}
@@ -156,7 +157,7 @@ getmntpt(const char *name)
{
struct stat devstat, mntdevstat;
char device[sizeof(_PATH_DEV) - 1 + MNAMELEN];
- char *devname;
+ char *dev_name;
struct statfs *mntbuf, *statfsp;
int i, mntsize, isdev;
@@ -169,10 +170,10 @@ getmntpt(const char *name)
mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
for (i = 0; i < mntsize; i++) {
statfsp = &mntbuf[i];
- devname = statfsp->f_mntfromname;
- if (*devname != '/') {
+ dev_name = statfsp->f_mntfromname;
+ if (*dev_name != '/') {
strcpy(device, _PATH_DEV);
- strcat(device, devname);
+ strcat(device, dev_name);
strcpy(statfsp->f_mntfromname, device);
}
if (isdev == 0) {
@@ -180,7 +181,7 @@ getmntpt(const char *name)
continue;
return (statfsp);
}
- if (stat(devname, &mntdevstat) == 0 &&
+ if (stat(dev_name, &mntdevstat) == 0 &&
mntdevstat.st_rdev == devstat.st_rdev)
return (statfsp);
}
OpenPOWER on IntegriCloud