[CRIU] [PATCH 01/19] zdtm: Add sstrncpy helper

Cyrill Gorcunov gorcunov at gmail.com
Fri Sep 14 17:08:24 MSK 2018


To elimitane compilation warnings with gcc-8.

Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
 test/zdtm/lib/zdtmtst.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/test/zdtm/lib/zdtmtst.h b/test/zdtm/lib/zdtmtst.h
index 1fbf795bf855..ae2ad593920f 100644
--- a/test/zdtm/lib/zdtmtst.h
+++ b/test/zdtm/lib/zdtmtst.h
@@ -168,4 +168,9 @@ extern pid_t sys_clone_unified(unsigned long flags, void *child_stack, void *par
 	___ret;									\
 })
 
+#define sstrncpy(d, s) ({							\
+	strncpy(d, s, sizeof(d)-1);						\
+	d[sizeof(d)-1] = '\0';							\
+})
+
 #endif /* _VIMITESU_H_ */
-- 
2.17.1



More information about the CRIU mailing list