Skip to contentSkip to conversation

master - coverity: use better function

PATCH Zdenek Kabelac 1 participant 1 message Jun 27, 2017

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e907535ab977ea29319aeb015cec6c06729f7ce4
Commit:        e907535ab977ea29319aeb015cec6c06729f7ce4
Parent:        e9c60f874ef02c8c5539310223e61e73a8103681
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Tue Jun 27 10:17:33 2017 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Tue Jun 27 12:15:42 2017 +0200

coverity: use better function

---
 lib/log/log.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
lib/log/log.c +2 -2
index f9d5649..8f52623 100644
@@ -375,8 +375,8 @@ void fin_syslog(void)
 
 void init_msg_prefix(const char *prefix)
 {
-	strncpy(_msg_prefix, prefix, sizeof(_msg_prefix) - 1);
-	_msg_prefix[sizeof(_msg_prefix) - 1] = '\0';
+	if (prefix)
+		dm_strncpy(_msg_prefix, prefix, sizeof(_msg_prefix) - 1);
 }
 
 void init_indent(int indent)