HomeClusterLabs Projects

Refactor: avoid warning triggering construct with GCC8

Description

Refactor: avoid warning triggering construct with GCC8

lrm.c: In function ‘unescape_newlines’:
lrm.c:2387:9: error: ‘strncpy’ output truncated before terminating

            nul copying 2 bytes from a string of the same
            length [-Werror=stringop-truncation]
strncpy(pch, "\n ", 2);
^~~~~~~~~~~~~~~~~~~~~~

It was actually purposeful here, so switch to less worrying memcpy
instead (deemed better alternative to stepwise indexed assignments).

Possibly relevant:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81117#c9

Details

Provenance
Jan Pokorný <jpokorny@redhat.com>Authored on Feb 27 2018, 6:22 PM
Parents
rPf788652cf420: Merge pull request #1426 from kgaillot/changes20
Branches
Unknown
Tags
Unknown

Event Timeline