Module Name: src
Committed By: apb
Date: Wed Jan 15 15:05:27 UTC 2014
Modified Files:
src/sbin/rndctl: rndctl.c
Log Message:
Overwrite the seed file from the beginning, using pwrite(2).
To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sbin/rndctl/rndctl.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/rndctl/rndctl.c
diff -u src/sbin/rndctl/rndctl.c:1.26 src/sbin/rndctl/rndctl.c:1.27
--- src/sbin/rndctl/rndctl.c:1.26 Wed Jan 15 10:13:25 2014
+++ src/sbin/rndctl/rndctl.c Wed Jan 15 15:05:27 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: rndctl.c,v 1.26 2014/01/15 10:13:25 joerg Exp $ */
+/* $NetBSD: rndctl.c,v 1.27 2014/01/15 15:05:27 apb Exp $ */
/*-
* Copyright (c) 1997 Michael Graff.
@@ -33,7 +33,7 @@
#include <sha1.h>
#ifndef lint
-__RCSID("$NetBSD: rndctl.c,v 1.26 2014/01/15 10:13:25 joerg Exp $");
+__RCSID("$NetBSD: rndctl.c,v 1.27 2014/01/15 15:05:27 apb Exp $");
#endif
@@ -203,7 +203,7 @@ do_load(const char *const filename)
}
memset(&rszero, 0, sizeof(rszero));
- if (write(fd, &rszero, sizeof(rszero)) != sizeof(rszero))
+ if (pwrite(fd, &rszero, sizeof(rszero), (off_t)0) != sizeof(rszero))
err(1, "overwrite");
fsync_range(fd, FDATASYNC|FDISKSYNC, (off_t)0, (off_t)0);
close(fd);