[pve-devel] [PATCH mini-journalreader 5/5] use memcpy/cmp instead of strncpy/cmp

Dominik Csapak d.csapak at proxmox.com
Thu May 16 11:32:32 CEST 2019


Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/mini-journalreader.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mini-journalreader.c b/src/mini-journalreader.c
index 3be348e..d5c55fd 100644
--- a/src/mini-journalreader.c
+++ b/src/mini-journalreader.c
@@ -91,12 +91,12 @@ static void print_reboot(sd_journal *j) {
 
     static char bootid[32];
     if (bootid[0] != '\0') { // we have some bootid
-        if (strncmp(bootid, d, l)) { // a new bootid found
-            strncpy(bootid, d, l);
+        if (memcmp(bootid, d, l)) { // a new bootid found
+            memcpy(bootid, d, l);
             print_to_buf("-- Reboot --\n", 13);
         }
     } else {
-        strncpy(bootid, d, l);
+        memcpy(bootid, d, l);
     }
 }
 
-- 
2.11.0





More information about the pve-devel mailing list