Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/rndctl Make "rndctl -L" overwrite the file with zeros, ...
details: https://anonhg.NetBSD.org/src/rev/04f8eaa26f3d
branches: trunk
changeset: 772078:04f8eaa26f3d
user: apb <apb%NetBSD.org@localhost>
date: Sat Dec 17 13:18:20 2011 +0000
description:
Make "rndctl -L" overwrite the file with zeros, not with the
same data that was just read from the file.
diffstat:
sbin/rndctl/rndctl.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diffs (37 lines):
diff -r 986bd5d85ce7 -r 04f8eaa26f3d sbin/rndctl/rndctl.c
--- a/sbin/rndctl/rndctl.c Sat Dec 17 12:59:21 2011 +0000
+++ b/sbin/rndctl/rndctl.c Sat Dec 17 13:18:20 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rndctl.c,v 1.22 2011/11/26 01:17:17 tls Exp $ */
+/* $NetBSD: rndctl.c,v 1.23 2011/12/17 13:18:20 apb Exp $ */
/*-
* Copyright (c) 1997 Michael Graff.
@@ -33,7 +33,7 @@
#include <sha1.h>
#ifndef lint
-__RCSID("$NetBSD: rndctl.c,v 1.22 2011/11/26 01:17:17 tls Exp $");
+__RCSID("$NetBSD: rndctl.c,v 1.23 2011/12/17 13:18:20 apb Exp $");
#endif
@@ -181,7 +181,7 @@
do_load(const char *const filename)
{
int fd;
- rndsave_t rs;
+ rndsave_t rs, rszero;
rnddata_t rd;
SHA1_CTX s;
uint8_t digest[SHA1_DIGEST_LENGTH];
@@ -197,7 +197,8 @@
err(1, "read");
}
- if (write(fd, &rs, sizeof(rs) != sizeof(rs))) {
+ memset(&rszero, 0, sizeof(rszero));
+ if (write(fd, &rszero, sizeof(rszero) != sizeof(rszero))) {
err(1, "overwrite");
}
fsync_range(fd, FDATASYNC|FDISKSYNC, (off_t)0, (off_t)0);
Home |
Main Index |
Thread Index |
Old Index