tools/libfsimage: Fix PATH_MAX redefinition error
authorCostin Lupu <costin.lupu@cs.pub.ro>
Tue, 8 Jun 2021 12:35:26 +0000 (15:35 +0300)
committerJulien Grall <jgrall@amazon.com>
Fri, 9 Jul 2021 14:59:59 +0000 (15:59 +0100)
If PATH_MAX is already defined in the system (e.g. in /usr/include/limits.h
header) then gcc will trigger a redefinition error because of -Werror.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Reviewed-by: Julien Grall <jgrall@amazon.com>
Acked-by: Ian Jackson <iwj@xenproject.org>
tools/libfsimage/ext2fs/fsys_ext2fs.c
tools/libfsimage/reiserfs/fsys_reiserfs.c

index a4ed10419c17c38c633eaf6adb3c15d121a887a6..5ed8fce90ef1dd663862f085865c7050a0eb9524 100644 (file)
@@ -278,7 +278,9 @@ struct ext4_extent_header {
 
 #define EXT2_SUPER_MAGIC      0xEF53   /* include/linux/ext2_fs.h */
 #define EXT2_ROOT_INO              2   /* include/linux/ext2_fs.h */
+#ifndef PATH_MAX
 #define PATH_MAX                1024   /* include/linux/limits.h */
+#endif
 #define MAX_LINK_COUNT             5   /* number of symbolic links to follow */
 
 /* made up, these are pointers into FSYS_BUF */
index 916eb152923ec0656bbb70d0ae10880e55b6a345..10ca65747678716d571afe9755158c4e10c56150 100644 (file)
@@ -284,7 +284,9 @@ struct reiserfs_de_head
 #define S_ISDIR(mode) (((mode) & 0170000) == 0040000)
 #define S_ISLNK(mode) (((mode) & 0170000) == 0120000)
 
+#ifndef PATH_MAX
 #define PATH_MAX       1024    /* include/linux/limits.h */
+#endif
 #define MAX_LINK_COUNT    5    /* number of symbolic links to follow */
 
 /* The size of the node cache */