diff gensignkey.c @ 983:2b62f26cf808

Open directories O_RDONLY for fsync, add debugging if it fails
author Matt Johnston <matt@ucc.asn.au>
date Sun, 04 Jan 2015 22:22:43 +0800
parents fd2e8bbb0333
children 2bb4c662d1c2
line wrap: on
line diff
--- a/gensignkey.c	Sat Nov 08 22:15:16 2014 +0800
+++ b/gensignkey.c	Sun Jan 04 22:22:43 2015 +0800
@@ -41,7 +41,9 @@
 
 out:
 	if (fd >= 0) {
-		fsync(fd);
+		if (fsync(fd) != 0) {
+			dropbear_log(LOG_ERR, "fsync of %s failed: %s", filename, strerror(errno));
+		}
 		m_close(fd);
 	}
 	return ret;