about summary refs log tree commit diff
path: root/nptl/tst-attr3.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2017-12-18 22:54:01 +0000
committerJoseph Myers <joseph@codesourcery.com>2017-12-18 22:54:01 +0000
commit5983df320af003a10ab2b965db1eecaca92c7056 (patch)
treea7ba76d7810dfdf889917004cf5db6bc2e3a5157 /nptl/tst-attr3.c
parent1421f39b7eadd3b5fbd2a3f2da1fc006b69fbc42 (diff)
downloadglibc-5983df320af003a10ab2b965db1eecaca92c7056.tar.gz
glibc-5983df320af003a10ab2b965db1eecaca92c7056.tar.xz
glibc-5983df320af003a10ab2b965db1eecaca92c7056.zip
Fix truncation warnings in posix/tst-glob_symlinks.c.
The test posix/tst-glob_symlinks.c fails to build with GCC mainline:

tst-glob_symlinks.c: In function 'do_test':
tst-glob_symlinks.c:124:30: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=]
   snprintf (buf, sizeof buf, "%s?", dangling_link);
                              ^~~~~
tst-glob_symlinks.c:124:3: note: 'snprintf' output between 2 and 4097 bytes into a destination of size 4096
   snprintf (buf, sizeof buf, "%s?", dangling_link);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tst-glob_symlinks.c:128:30: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=]
   snprintf (buf, sizeof buf, "%s*", dangling_link);
                              ^~~~~
tst-glob_symlinks.c:128:3: note: 'snprintf' output between 2 and 4097 bytes into a destination of size 4096
   snprintf (buf, sizeof buf, "%s*", dangling_link);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This patch fixes the test to avoid such truncation warnings by
increasing the buffer in question by one byte, to ensure it can hold
any possible result of %s? or %s* formats where %s comes from a buffer
of size PATH_MAX.

Tested compilation with build-many-glibcs.py for aarch64-linux-gnu.

	* posix/tst-glob_symlinks.c (do_test): Increase size of buf.
Diffstat (limited to 'nptl/tst-attr3.c')
0 files changed, 0 insertions, 0 deletions