Skip to content
  • Eric Blake's avatar
    dump: Fix build with newer gcc · 84c868f6
    Eric Blake authored
    
    
    gcc 8 on rawhide is picky enough to complain:
    
    /home/dummy/qemu/dump.c: In function 'create_header32':
    /home/dummy/qemu/dump.c:817:5: error: 'strncpy' output truncated before terminating nul copying 8 bytes from a string of the same length [-Werror=stringop-truncation]
         strncpy(dh->signature, KDUMP_SIGNATURE, strlen(KDUMP_SIGNATURE));
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    But we already have SIG_LEN defined as the right length without needing
    to do a strlen(), and memcpy() is better than strncpy() when we know
    we do not want a trailing NUL byte.
    
    Signed-off-by: default avatarEric Blake <eblake@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    84c868f6