summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
Diffstat (limited to 'sbin')
-rw-r--r--sbin/fsck/fsutil.c15
-rw-r--r--sbin/fsck/fsutil.h4
-rw-r--r--sbin/fsck_msdos/boot.c16
-rw-r--r--sbin/fsck_msdos/check.c6
-rw-r--r--sbin/fsck_msdos/dir.c24
-rw-r--r--sbin/fsck_msdos/fat.c14
6 files changed, 39 insertions, 40 deletions
diff --git a/sbin/fsck/fsutil.c b/sbin/fsck/fsutil.c
index 11253bf2bef..768f96cb3fa 100644
--- a/sbin/fsck/fsutil.c
+++ b/sbin/fsck/fsutil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fsutil.c,v 1.13 2003/09/25 04:15:29 deraadt Exp $ */
+/* $OpenBSD: fsutil.c,v 1.14 2006/05/27 22:30:09 thib Exp $ */
/* $NetBSD: fsutil.c,v 1.2 1996/10/03 20:06:31 christos Exp $ */
/*
@@ -30,7 +30,7 @@
* SUCH DAMAGE.
*/
#ifndef lint
-static const char rcsid[] = "$OpenBSD: fsutil.c,v 1.13 2003/09/25 04:15:29 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: fsutil.c,v 1.14 2006/05/27 22:30:09 thib Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -93,9 +93,8 @@ vmsg(int fatal, const char *fmt, va_list ap)
(void) printf("%s: ", dev);
(void) vprintf(fmt, ap);
-
+ printf("\n");
if (fatal && preen) {
- (void) printf("\n");
(void) printf(
"%s: UNEXPECTED INCONSISTENCY; RUN %s MANUALLY.\n",
dev, __progname);
@@ -126,7 +125,7 @@ pwarn(const char *fmt, ...)
}
void
-perror(const char *s)
+xperror(const char *s)
{
pfatal("%s (%s)", s, strerror(errno));
}
@@ -186,14 +185,14 @@ blockcheck(char *origname)
hot = 0;
if (stat("/", &stslash) < 0) {
- perror("/");
+ xperror("/");
printf("Can't stat root\n");
return (origname);
}
newname = origname;
retry:
if (stat(newname, &stblock) < 0) {
- perror(newname);
+ xperror(newname);
printf("Can't stat %s\n", newname);
return (origname);
}
@@ -202,7 +201,7 @@ retry:
hot++;
raw = rawname(newname);
if (stat(raw, &stchar) < 0) {
- perror(raw);
+ xperror(raw);
printf("Can't stat %s\n", raw);
return (origname);
}
diff --git a/sbin/fsck/fsutil.h b/sbin/fsck/fsutil.h
index b39bbe2f547..e7d9d28e421 100644
--- a/sbin/fsck/fsutil.h
+++ b/sbin/fsck/fsutil.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: fsutil.h,v 1.4 2002/06/09 08:13:05 todd Exp $ */
+/* $OpenBSD: fsutil.h,v 1.5 2006/05/27 22:30:09 thib Exp $ */
/* $NetBSD: fsutil.h,v 1.3 1996/10/03 20:06:31 christos Exp $ */
/*
@@ -30,7 +30,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-void perror(const char *);
+void xperror(const char *);
void errexit(const char *, ...)
__attribute__((__noreturn__,__format__(__printf__,1,2)));
void pfatal(const char *, ...)
diff --git a/sbin/fsck_msdos/boot.c b/sbin/fsck_msdos/boot.c
index c552bd4d1f2..ddfa5fac2ff 100644
--- a/sbin/fsck_msdos/boot.c
+++ b/sbin/fsck_msdos/boot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: boot.c,v 1.10 2004/07/17 02:14:33 deraadt Exp $ */
+/* $OpenBSD: boot.c,v 1.11 2006/05/27 22:30:09 thib Exp $ */
/* $NetBSD: boot.c,v 1.5 1997/10/17 11:19:23 ws Exp $ */
/*
@@ -35,7 +35,7 @@
#ifndef lint
-static char rcsid[] = "$OpenBSD: boot.c,v 1.10 2004/07/17 02:14:33 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: boot.c,v 1.11 2006/05/27 22:30:09 thib Exp $";
#endif /* not lint */
#include <stdlib.h>
@@ -55,7 +55,7 @@ readboot(int dosfs, struct bootblock *boot)
int ret = FSOK;
if (read(dosfs, block, sizeof block) < sizeof block) {
- perror("could not read boot block");
+ xperror("could not read boot block");
return (FSFATAL);
}
@@ -107,7 +107,7 @@ readboot(int dosfs, struct bootblock *boot)
!= boot->FSInfo * boot->BytesPerSec
|| read(dosfs, fsinfo, sizeof fsinfo)
!= sizeof fsinfo) {
- perror("could not read fsinfo block");
+ xperror("could not read fsinfo block");
return FSFATAL;
}
if (memcmp(fsinfo, "RRaA", 4)
@@ -134,7 +134,7 @@ readboot(int dosfs, struct bootblock *boot)
!= boot->FSInfo * boot->BytesPerSec
|| write(dosfs, fsinfo, sizeof fsinfo)
!= sizeof fsinfo) {
- perror("Unable to write FSInfo");
+ xperror("Unable to write FSInfo");
return FSFATAL;
}
ret = FSBOOTMOD;
@@ -153,7 +153,7 @@ readboot(int dosfs, struct bootblock *boot)
if (lseek(dosfs, boot->Backup * boot->BytesPerSec, SEEK_SET)
!= boot->Backup * boot->BytesPerSec
|| read(dosfs, backup, sizeof backup) != sizeof backup) {
- perror("could not read backup bootblock");
+ xperror("could not read backup bootblock");
return FSFATAL;
}
if (memcmp(block, backup, DOSBOOTBLOCKSIZE)) {
@@ -232,7 +232,7 @@ writefsinfo(int dosfs, struct bootblock *boot)
if (lseek(dosfs, boot->FSInfo * boot->BytesPerSec, SEEK_SET)
!= boot->FSInfo * boot->BytesPerSec
|| read(dosfs, fsinfo, sizeof fsinfo) != sizeof fsinfo) {
- perror("could not read fsinfo block");
+ xperror("could not read fsinfo block");
return FSFATAL;
}
fsinfo[0x1e8] = (u_char)boot->FSFree;
@@ -247,7 +247,7 @@ writefsinfo(int dosfs, struct bootblock *boot)
!= boot->FSInfo * boot->BytesPerSec
|| write(dosfs, fsinfo, sizeof fsinfo)
!= sizeof fsinfo) {
- perror("Unable to write FSInfo");
+ xperror("Unable to write FSInfo");
return FSFATAL;
}
/*
diff --git a/sbin/fsck_msdos/check.c b/sbin/fsck_msdos/check.c
index 3ddf010528c..a2af26aa2a1 100644
--- a/sbin/fsck_msdos/check.c
+++ b/sbin/fsck_msdos/check.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: check.c,v 1.10 2004/07/17 02:14:33 deraadt Exp $ */
+/* $OpenBSD: check.c,v 1.11 2006/05/27 22:30:09 thib Exp $ */
/* $NetBSD: check.c,v 1.8 1997/10/17 11:19:29 ws Exp $ */
/*
@@ -35,7 +35,7 @@
#ifndef lint
-static char rcsid[] = "$OpenBSD: check.c,v 1.10 2004/07/17 02:14:33 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: check.c,v 1.11 2006/05/27 22:30:09 thib Exp $";
#endif /* not lint */
#include <stdlib.h>
@@ -72,7 +72,7 @@ checkfilesys(const char *fname)
printf("\n");
if (dosfs < 0) {
- perror("Can't open");
+ xperror("Can't open");
return (8);
}
diff --git a/sbin/fsck_msdos/dir.c b/sbin/fsck_msdos/dir.c
index 589dfddd212..e45647e7ecc 100644
--- a/sbin/fsck_msdos/dir.c
+++ b/sbin/fsck_msdos/dir.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dir.c,v 1.19 2004/07/17 02:14:33 deraadt Exp $ */
+/* $OpenBSD: dir.c,v 1.20 2006/05/27 22:30:09 thib Exp $ */
/* $NetBSD: dir.c,v 1.11 1997/10/17 11:19:35 ws Exp $ */
/*
@@ -37,7 +37,7 @@
#ifndef lint
-static char rcsid[] = "$OpenBSD: dir.c,v 1.19 2004/07/17 02:14:33 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: dir.c,v 1.20 2006/05/27 22:30:09 thib Exp $";
#endif /* not lint */
#include <stdio.h>
@@ -234,7 +234,7 @@ resetDosDirSection(struct bootblock *boot, struct fatEntry *fat)
if (!(buffer = malloc(b1 > b2 ? b1 : b2))
|| !(delbuf = malloc(b2))
|| !(rootDir = newDosDirEntry())) {
- perror("No space for directory");
+ xperror("No space for directory");
return (FSFATAL);
}
(void)memset(rootDir, 0, sizeof *rootDir);
@@ -324,7 +324,7 @@ delete(int f, struct bootblock *boot, struct fatEntry *fat, cl_t startcl,
off *= boot->BytesPerSec;
if (lseek(f, off, SEEK_SET) != off
|| read(f, delbuf, clsz) != clsz) {
- perror("Unable to read directory");
+ xperror("Unable to read directory");
return (FSFATAL);
}
while (s < e) {
@@ -333,7 +333,7 @@ delete(int f, struct bootblock *boot, struct fatEntry *fat, cl_t startcl,
}
if (lseek(f, off, SEEK_SET) != off
|| write(f, delbuf, clsz) != clsz) {
- perror("Unable to write directory");
+ xperror("Unable to write directory");
return (FSFATAL);
}
if (startcl == endcl)
@@ -467,7 +467,7 @@ readDosDirSection(int f, struct bootblock *boot, struct fatEntry *fat,
off *= boot->BytesPerSec;
if (lseek(f, off, SEEK_SET) != off
|| read(f, buffer, last) != last) {
- perror("Unable to read directory");
+ xperror("Unable to read directory");
return (FSFATAL);
}
last /= 32;
@@ -811,7 +811,7 @@ readDosDirSection(int f, struct bootblock *boot, struct fatEntry *fat,
/* create directory tree node */
if (!(d = newDosDirEntry())) {
- perror("No space for directory");
+ xperror("No space for directory");
return (FSFATAL);
}
(void)memcpy(d, &dirent, sizeof(struct dosDirEntry));
@@ -820,7 +820,7 @@ readDosDirSection(int f, struct bootblock *boot, struct fatEntry *fat,
/* Enter this directory into the todo list */
if (!(n = newDirTodo())) {
- perror("No space for todo list");
+ xperror("No space for todo list");
return (FSFATAL);
}
n->next = pendingDirectories;
@@ -837,7 +837,7 @@ readDosDirSection(int f, struct bootblock *boot, struct fatEntry *fat,
last *= 32;
if (lseek(f, off, SEEK_SET) != off
|| write(f, buffer, last) != last) {
- perror("Unable to write directory");
+ xperror("Unable to write directory");
return (FSFATAL);
}
mod &= ~THISMOD;
@@ -927,7 +927,7 @@ reconnect(int dosfs, struct bootblock *boot, struct fatEntry *fat, cl_t head)
if (!lfbuf) {
lfbuf = malloc(boot->ClusterSize);
if (!lfbuf) {
- perror("No space for buffer");
+ xperror("No space for buffer");
return (FSFATAL);
}
p = NULL;
@@ -951,7 +951,7 @@ reconnect(int dosfs, struct bootblock *boot, struct fatEntry *fat, cl_t head)
+ boot->ClusterOffset * boot->BytesPerSec;
if (lseek(dosfs, lfoff, SEEK_SET) != lfoff
|| read(dosfs, lfbuf, boot->ClusterSize) != boot->ClusterSize) {
- perror("could not read LOST.DIR");
+ xperror("could not read LOST.DIR");
return (FSFATAL);
}
p = lfbuf;
@@ -981,7 +981,7 @@ reconnect(int dosfs, struct bootblock *boot, struct fatEntry *fat, cl_t head)
fat[head].flags |= FAT_USED;
if (lseek(dosfs, lfoff, SEEK_SET) != lfoff
|| write(dosfs, lfbuf, boot->ClusterSize) != boot->ClusterSize) {
- perror("could not write LOST.DIR");
+ xperror("could not write LOST.DIR");
return (FSFATAL);
}
return (FSDIRMOD);
diff --git a/sbin/fsck_msdos/fat.c b/sbin/fsck_msdos/fat.c
index b81c3188fbc..bf337ab081f 100644
--- a/sbin/fsck_msdos/fat.c
+++ b/sbin/fsck_msdos/fat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fat.c,v 1.14 2006/04/02 21:38:56 djm Exp $ */
+/* $OpenBSD: fat.c,v 1.15 2006/05/27 22:30:09 thib Exp $ */
/* $NetBSD: fat.c,v 1.8 1997/10/17 11:19:53 ws Exp $ */
/*
@@ -35,7 +35,7 @@
#ifndef lint
-static char rcsid[] = "$OpenBSD: fat.c,v 1.14 2006/04/02 21:38:56 djm Exp $";
+static char rcsid[] = "$OpenBSD: fat.c,v 1.15 2006/05/27 22:30:09 thib Exp $";
#endif /* not lint */
#include <stdlib.h>
@@ -97,7 +97,7 @@ readfat(int fs, struct bootblock *boot, int no, struct fatEntry **fp)
fat = calloc(boot->NumClusters, sizeof(struct fatEntry));
buffer = malloc(boot->FATsecs * boot->BytesPerSec);
if (fat == NULL || buffer == NULL) {
- perror("No space for FAT");
+ xperror("No space for FAT");
if (fat)
free(fat);
return (FSFATAL);
@@ -107,7 +107,7 @@ readfat(int fs, struct bootblock *boot, int no, struct fatEntry **fp)
off *= boot->BytesPerSec;
if (lseek(fs, off, SEEK_SET) != off) {
- perror("Unable to read FAT");
+ xperror("Unable to read FAT");
free(buffer);
free(fat);
return (FSFATAL);
@@ -115,7 +115,7 @@ readfat(int fs, struct bootblock *boot, int no, struct fatEntry **fp)
if (read(fs, buffer, boot->FATsecs * boot->BytesPerSec)
!= boot->FATsecs * boot->BytesPerSec) {
- perror("Unable to read FAT");
+ xperror("Unable to read FAT");
free(buffer);
free(fat);
return (FSFATAL);
@@ -432,7 +432,7 @@ writefat(int fs, struct bootblock *boot, struct fatEntry *fat)
buffer = malloc(fatsz = boot->FATsecs * boot->BytesPerSec);
if (buffer == NULL) {
- perror("No space for FAT");
+ xperror("No space for FAT");
return (FSFATAL);
}
(void)memset(buffer, 0, fatsz);
@@ -488,7 +488,7 @@ writefat(int fs, struct bootblock *boot, struct fatEntry *fat)
off *= boot->BytesPerSec;
if (lseek(fs, off, SEEK_SET) != off
|| write(fs, buffer, fatsz) != fatsz) {
- perror("Unable to write FAT");
+ xperror("Unable to write FAT");
ret = FSFATAL; /* Return immediately? XXX */
}
}