summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>1998-01-22 05:13:18 +0000
committermillert <millert@openbsd.org>1998-01-22 05:13:18 +0000
commitb64f3f39e31fe7bba63b31cdbf1f5e7c9529800e (patch)
treeae695802a3bf33b9112b4b9592ebf2ac2a0a4213
parentSplit up the buffercache between low (<16MB) and high memory, so that (diff)
downloadwireguard-openbsd-b64f3f39e31fe7bba63b31cdbf1f5e7c9529800e.tar.xz
wireguard-openbsd-b64f3f39e31fe7bba63b31cdbf1f5e7c9529800e.zip
Fix sanity check of backup sblocks as well as error message.
-rw-r--r--sbin/fsirand/fsirand.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sbin/fsirand/fsirand.c b/sbin/fsirand/fsirand.c
index 97bd3553acc..1e645322ae6 100644
--- a/sbin/fsirand/fsirand.c
+++ b/sbin/fsirand/fsirand.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fsirand.c,v 1.10 1997/08/11 02:52:31 millert Exp $ */
+/* $OpenBSD: fsirand.c,v 1.11 1998/01/22 05:13:18 millert Exp $ */
/*
* Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -31,7 +31,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: fsirand.c,v 1.10 1997/08/11 02:52:31 millert Exp $";
+static char rcsid[] = "$OpenBSD: fsirand.c,v 1.11 1998/01/22 05:13:18 millert Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -175,9 +175,9 @@ fsirand(device)
if (lseek(devfd, (off_t)dblk * (off_t)bsize, SEEK_SET) < 0) {
warn("Can't seek to %qd", (off_t)dblk * bsize);
return (1);
- } else if ((n = write(devfd, (void *)sblock, SBSIZE)) != SBSIZE) {
+ } else if ((n = read(devfd, (void *)sblock, SBSIZE)) != SBSIZE) {
warn("Can't read backup superblock %d on %s: %s",
- cg + 1, devpath, (n < SBSIZE) ? "short write"
+ cg + 1, devpath, (n < SBSIZE) ? "short read"
: strerror(errno));
return (1);
}
@@ -222,7 +222,7 @@ fsirand(device)
return (1);
}
if ((n = write(devfd, (void *)sblock, SBSIZE)) != SBSIZE) {
- warn("Can't read superblock on %s: %s", devpath,
+ warn("Can't write superblock on %s: %s", devpath,
(n < SBSIZE) ? "short write" : strerror(errno));
return (1);
}