[01/19] zdtm: Add sstrncpy helper

Submitted by Cyrill Gorcunov on Sept. 14, 2018, 2:08 p.m.

Details

Message ID 20180914140842.6462-2-gorcunov@gmail.com
State New
Series "unix: Add support for bindmounted dgram sockets"
Headers show

Commit Message

Cyrill Gorcunov Sept. 14, 2018, 2:08 p.m.
To elimitane compilation warnings with gcc-8.

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

Patch hide | download patch | download mbox

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_ */