zgetdump: Replace strncpy() with memcpy()

We can safely replace strncpy() with memcpy() here and get rid of the
following compile warnings:

dfi_s390mv.c: In function ‘set_magic_numbers’:
dfi_s390mv.c:570:3: warning: ‘strncpy’ output truncated before
terminating nul copying 7 bytes fr om a string of the same length
[-Wstringop-truncation]
   strncpy(l.dumper_magic, DF_S390_DUMPER_MAGIC_MV_EXT, 7);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dfi_s390mv.c:573:3: warning: ‘strncpy’ output truncated before
terminating nul copying 7 bytes fr om a string of the same length
[-Wstringop-truncation]
   strncpy(l.dumper_magic, DF_S390_DUMPER_MAGIC_MV, 7);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Jan Höppner
2018-11-05 13:20:59 +01:00
parent 70a79fab3c
commit c2297a0a7e

View File

@@ -568,10 +568,10 @@ static void set_magic_numbers(void)
{
if (l.extended) {
l.magic_number = DF_S390_MAGIC_EXT;
strncpy(l.dumper_magic, DF_S390_DUMPER_MAGIC_MV_EXT, 7);
memcpy(l.dumper_magic, DF_S390_DUMPER_MAGIC_MV_EXT, 7);
} else {
l.magic_number = DF_S390_MAGIC;
strncpy(l.dumper_magic, DF_S390_DUMPER_MAGIC_MV, 7);
memcpy(l.dumper_magic, DF_S390_DUMPER_MAGIC_MV, 7);
}
}