squashfs: Fix compile with GCC 10
[openwrt/openwrt.git] / tools / squashfs / patches / 140-gcc-10-fix.patch
1 Fixes the following build error with GCC 10:
2 /usr/bin/ld: read_fs.o:(.bss+0x0): multiple definition of `swap'; mksquashfs.o:(.bss+0x1b2a88): first defined here
3 And a compile warning.
4
5 --- a/squashfs-tools/read_fs.c
6 +++ b/squashfs-tools/read_fs.c
7 @@ -61,7 +61,7 @@ extern int add_file(long long, long long
8 fprintf(stderr, s, ## args); \
9 } while(0)
10
11 -int swap;
12 +static int swap;
13
14 int read_block(int fd, long long start, long long *next, unsigned char *block, squashfs_super_block *sBlk)
15 {
16 --- a/squashfs-tools/mksquashfs.c
17 +++ b/squashfs-tools/mksquashfs.c
18 @@ -258,6 +258,7 @@ int read_sort_file(char *filename, int s
19 void sort_files_and_write(struct dir_info *dir);
20 struct file_info *duplicate(char *(get_next_file_block)(struct duplicate_buffer_handle *, unsigned int), struct duplicate_buffer_handle *file_start, long long bytes, unsigned int **block_list, long long *start, int blocks, struct fragment **fragment, char *frag_data, int frag_bytes);
21 struct dir_info *dir_scan1(char *, int (_readdir)(char *, char *, struct dir_info *));
22 +int dir_scan2(squashfs_inode *inode, struct dir_info *dir_info);
23
24 #define MKINODE(A) ((squashfs_inode)(((squashfs_inode) inode_bytes << 16) + (((char *)A) - data_cache)))
25