projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Commas at the end of enumerator lists aren't allowed.
[u/mdw/putty]
/
unix
/
uxstore.c
diff --git
a/unix/uxstore.c
b/unix/uxstore.c
index
d787ba4
..
670c67b
100644
(file)
--- a/
unix/uxstore.c
+++ b/
unix/uxstore.c
@@
-318,13
+318,18
@@
void write_random_seed(void *data, int len)
char fname[FILENAME_MAX];
make_filename(fname, INDEX_RANDSEED);
char fname[FILENAME_MAX];
make_filename(fname, INDEX_RANDSEED);
- fd = open(fname, O_CREAT | O_TRUNC | O_WRONLY, 0600);
+ /*
+ * Don't truncate the random seed file if it already exists; if
+ * something goes wrong half way through writing it, it would
+ * be better to leave the old data there than to leave it empty.
+ */
+ fd = open(fname, O_CREAT | O_WRONLY, 0600);
if (fd < 0) {
char dir[FILENAME_MAX];
make_filename(dir, INDEX_DIR);
mkdir(dir, 0700);
if (fd < 0) {
char dir[FILENAME_MAX];
make_filename(dir, INDEX_DIR);
mkdir(dir, 0700);
- fd = open(fname, O_CREAT | O_
TRUNC | O_
WRONLY, 0600);
+ fd = open(fname, O_CREAT | O_WRONLY, 0600);
}
while (len > 0) {
}
while (len > 0) {