diff dbutil.h @ 1596:60fceff95858

workaround memory sanitizer FD_ZERO false positives
author Matt Johnston <matt@ucc.asn.au>
date Tue, 06 Mar 2018 21:51:51 +0800
parents 5916af64acd4
children e11ed628708b
line wrap: on
line diff
--- a/dbutil.h	Tue Mar 06 21:00:09 2018 +0800
+++ b/dbutil.h	Tue Mar 06 21:51:51 2018 +0800
@@ -88,4 +88,11 @@
 
 void fsync_parent_dir(const char* fn);
 
+#if DROPBEAR_MSAN
+/* FD_ZERO seems to leave some memory uninitialized. clear it to avoid false positives */
+#define DROPBEAR_FD_ZERO(fds) do { memset((fds), 0x0, sizeof(fd_set)); FD_ZERO(fds); } while(0)
+#else
+#define DROPBEAR_FD_ZERO(fds) FD_ZERO(fds)
+#endif
+
 #endif /* DROPBEAR_DBUTIL_H_ */