From a71be9dcec629e0d839ad11c554cda08d5b3a61d Mon Sep 17 00:00:00 2001 From: Erik Boasson Date: Wed, 9 Oct 2019 16:24:46 +0200 Subject: [PATCH] Remove all occurrences of strncpy Too many compilers warn about correct use of strncpy these days ... Signed-off-by: Erik Boasson --- src/core/ddsi/src/q_thread.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/core/ddsi/src/q_thread.c b/src/core/ddsi/src/q_thread.c index 9708b8f..60e8afa 100644 --- a/src/core/ddsi/src/q_thread.c +++ b/src/core/ddsi/src/q_thread.c @@ -251,10 +251,7 @@ static struct thread_state1 *init_thread_state (const char *tname, const struct ts = &thread_states.ts[cand]; ddsrt_atomic_stvoidp (&ts->gv, (struct q_globals *) gv); assert (vtime_asleep_p (ddsrt_atomic_ld32 (&ts->vtime))); - DDSRT_WARNING_MSVC_OFF(4996); - strncpy (ts->name, tname, sizeof (ts->name)); - DDSRT_WARNING_MSVC_ON(4996); - ts->name[sizeof (ts->name) - 1] = 0; + ddsrt_strlcpy (ts->name, tname, sizeof (ts->name)); ts->state = state; return ts;