[CRIU] [PATCH 1/9] zdtm: Add sstrncpy helper
Cyrill Gorcunov
gorcunov at gmail.com
Sat Jun 9 16:26:03 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.14.4
More information about the CRIU
mailing list