X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/3980e64ffbb86a37d6810b004a04a21f338a408b..ba9cb5ecbb10de0566a9a4b1785f10bc42ec198f:/unix/uxstore.c diff --git a/unix/uxstore.c b/unix/uxstore.c index 372c224d..d97185e1 100644 --- a/unix/uxstore.c +++ b/unix/uxstore.c @@ -651,7 +651,12 @@ void store_host_key(const char *hostname, int port, fclose(wfp); - rename(tmpfilename, filename); + if (rename(tmpfilename, filename) < 0) { + char *msg = dupprintf("Unable to store host key: rename(\"%s\",\"%s\")" + " returned '%s'", tmpfilename, filename, + strerror(errno)); + nonfatal(msg); + } sfree(tmpfilename); sfree(filename); @@ -711,7 +716,7 @@ void write_random_seed(void *data, int len) sfree(dir); fd = open(fname, O_CREAT | O_WRONLY, 0600); - if (errno != ENOENT) { + if (fd < 0) { char *msg = dupprintf("Unable to write random seed: open(\"%s\") " "returned '%s'", fname, strerror(errno)); nonfatal(msg);