Projects
home:lf14:branches:Mega:23.09
glibc
_service:tar_scm:backport-clang-0046-dirent-Rem...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:backport-clang-0046-dirent-Remove-variable-lenght-array-structure-for.patch of Package glibc
From 7438bae37bc2678b200eaa9366dfcbbd8fd5b7c7 Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella <adhemerval.zanella@linaro.org> Date: Fri, 25 Mar 2022 09:03:03 -0300 Subject: [PATCH] dirent: Remove variable lenght array structure for tst-getdents64.c Clang emits the following warnings: ../sysdeps/unix/sysv/linux/tst-getdents64.c:111:18: error: fields must have a constant size: 'variable length array in structure' extension will never be supported char buffer[buffer_size]; ^ --- sysdeps/unix/sysv/linux/tst-getdents64.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/sysdeps/unix/sysv/linux/tst-getdents64.c b/sysdeps/unix/sysv/linux/tst-getdents64.c index 39cf34cd4d..b177956ca6 100644 --- a/sysdeps/unix/sysv/linux/tst-getdents64.c +++ b/sysdeps/unix/sysv/linux/tst-getdents64.c @@ -96,6 +96,8 @@ do_test_by_size (size_t buffer_size) int fd = xopen (".", O_RDONLY | O_DIRECTORY, 0); TEST_VERIFY (fd >= 0); + char *data = xposix_memalign (_Alignof (struct dirent64), buffer_size); + /* Perform two passes, with a rewind operating between passes. */ for (int pass = 0; pass < 2; ++pass) { @@ -104,23 +106,15 @@ do_test_by_size (size_t buffer_size) while (true) { - /* Simple way to make sure that the memcpy below does not read - non-existing data. */ - struct - { - char buffer[buffer_size]; - struct dirent64 pad; - } data; - - ssize_t ret = getdents64 (fd, &data.buffer, sizeof (data.buffer)); + ssize_t ret = getdents64 (fd, data, buffer_size); if (ret < 0) FAIL_EXIT1 ("getdents64: %m"); if (ret == 0) break; ++read_count; - char *current = data.buffer; - char *end = data.buffer + ret; + char *current = data; + char *end = data + ret; while (current != end) { struct dirent64 entry; -- 2.39.3
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2