Ok I eventually realised you did it this way on purpose and even the buffer should be big enough for most cases as trivial nfs4 ACL is typically bigger than any list of xattrs we might ever receive.
Sorry for the noise then... Ondrej Zasláno z Outlooku pro Android<https://aka.ms/AAb9ysg> ________________________________ From: Paul Eggert <egg...@cs.ucla.edu> Sent: Monday, May 15, 2023 11:32:00 PM To: Ondrej Valousek <ondrej.valousek...@renesas.com> Cc: Gnulib bugs <bug-gnulib@gnu.org> Subject: Re: [PATCH] fix NFSv4 acl detection on F39 On 2023-05-15 12:43, Ondrej Valousek wrote: > You feed listxattr() with a buffer sized like trivial_NFS4_attr_buf - that > just does not seem to be correct right? That trivial_NFS4_attr_buf serves > smth completely different. All that listxattr needs is a nonzero-sized buffer. It's OK for a union to hold unrelated objects so long as it doesn't hold them at the same time, which is the case here. The code could allocate two distinct stack buffers of different types, but that'd use more stack space and put more pressure on caches. It could even allocate the distinct buffers in non-overlapping compound statements, but GCC isn't good about optimizating that and anyway the code would get trickier in a different way.