Fix false positive -Wstringop-truncation

Fix false positive stringop-truncation warning/error with GCC 10 on s390x by indicating GCC to explicitly ignore this case, as it is clearly a false positive (NUL is set in the following line).

This allow the compilation to succeed with -Werror on.

Fixes: https://github.com/swaywm/wlroots/issues/2018
This commit is contained in:
Lukas Märdian 2021-03-03 11:37:36 +01:00 committed by Simon Ser
parent 46d2f80c38
commit d8a422575b
1 changed files with 3 additions and 0 deletions

View File

@ -655,8 +655,11 @@ _XcursorAddPathElt (char *path, const char *elt, int len)
elt++;
len--;
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-truncation"
strncpy (path + pathlen, elt, len);
path[pathlen + len] = '\0';
#pragma GCC diagnostic pop
}
static char *