upgrade busybox to v1.11.1 and add current upstream fixes
[openwrt-10.03/.git] / package / busybox / patches / 902-tar.patch
1 --- a/archival/libunarchive/get_header_tar.c
2 +++ b/archival/libunarchive/get_header_tar.c
3 @@ -261,26 +261,33 @@
4         case '0':
5  #if ENABLE_FEATURE_TAR_OLDGNU_COMPATIBILITY
6                 if (last_char_is(file_header->name, '/')) {
7 -                       file_header->mode |= S_IFDIR;
8 -               } else
9 +                       goto set_dir;
10 +               }
11  #endif
12                 file_header->mode |= S_IFREG;
13                 break;
14         case '2':
15                 file_header->mode |= S_IFLNK;
16 +               /* have seen tarballs with size field containing
17 +                * the size of the link target's name */
18 + size0:
19 +               file_header->size = 0;
20                 break;
21         case '3':
22                 file_header->mode |= S_IFCHR;
23 -               break;
24 +               goto size0; /* paranoia */
25         case '4':
26                 file_header->mode |= S_IFBLK;
27 -               break;
28 +               goto size0;
29         case '5':
30 +#if ENABLE_FEATURE_TAR_OLDGNU_COMPATIBILITY
31 + set_dir:
32 +#endif
33                 file_header->mode |= S_IFDIR;
34 -               break;
35 +               goto size0;
36         case '6':
37                 file_header->mode |= S_IFIFO;
38 -               break;
39 +               goto size0;
40  #if ENABLE_FEATURE_TAR_GNU_EXTENSIONS
41         case 'L':
42                 /* free: paranoia: tar with several consecutive longnames */
43 --- a/archival/libunarchive/seek_by_jump.c
44 +++ b/archival/libunarchive/seek_by_jump.c
45 @@ -8,7 +8,9 @@
46  
47  void seek_by_jump(const archive_handle_t *archive_handle, unsigned amount)
48  {
49 -       if (lseek(archive_handle->src_fd, (off_t) amount, SEEK_CUR) == (off_t) -1) {
50 +       if (amount
51 +        && lseek(archive_handle->src_fd, (off_t) amount, SEEK_CUR) == (off_t) -1
52 +       ) {
53                 if (errno == ESPIPE)
54                         seek_by_read(archive_handle, amount);
55                 else