Skip to content

Commit

Permalink
common: Only check strndup behavior when replacement is used
Browse files Browse the repository at this point in the history
Otherwise GCC 11 complains with -Wstringop-overread.

Signed-off-by: Daiki Ueno <[email protected]>
ueno committed Jun 3, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 9832f8b commit 3482662
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions common/test-compat.c
Original file line number Diff line number Diff line change
@@ -46,6 +46,8 @@

#include "compat.h"

#ifndef HAVE_STRNDUP

static void
test_strndup (void)
{
@@ -61,6 +63,8 @@ test_strndup (void)
free (res);
}

#endif

#ifdef OS_UNIX

static void
@@ -163,7 +167,9 @@ int
main (int argc,
char *argv[])
{
#ifndef HAVE_STRNDUP
p11_test (test_strndup, "/compat/strndup");
#endif
#ifdef OS_UNIX
/* Don't run this test when under fakeroot, or the binary is
* written under /tmp */

0 comments on commit 3482662

Please sign in to comment.