bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#9077: coreutils-8.12: fiemap.h uses "struct fiemap_extent fm_extents


From: Paul Eggert
Subject: bug#9077: coreutils-8.12: fiemap.h uses "struct fiemap_extent fm_extents[0]; "
Date: Thu, 14 Jul 2011 15:50:07 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110621 Fedora/3.1.11-1.fc14 Thunderbird/3.1.11

On 07/14/11 04:45, Pádraig Brady wrote:
> The non standard "zero length array" syntax was copied from
> the linux kernel headers. Changing this to a C99 flexible array
> as you suggest, should be fine according to the constraints listed here:

Won't this break non-GCC compilers that don't support
C99 flexible arrays?

Instead, how about this patch?  If I understand things correctly,
it should fix the problem on NonStop, and should also work with
pre-C99 non-GCC compilers.

diff --git a/src/fiemap.h b/src/fiemap.h
index 1938c74..e7243b4 100644
--- a/src/fiemap.h
+++ b/src/fiemap.h
@@ -51,8 +51,9 @@ struct fiemap
 
   uint32_t fm_reserved;
 
-  /* Array of mapped extents(out).  */
-  struct fiemap_extent fm_extents[0];
+  /* Array of mapped extents(out).
+     The actual size is given by fm_extent_count.  */
+  struct fiemap_extent fm_extents[1];
 };
 
 /* The maximum offset can be mapped for a file.  */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]