wok rev 1641
busybox: fix cpio TRAILER!!! with hard links
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Oct 25 12:09:31 2008 +0000 (2008-10-25) |
parents | 8c8ce3310a17 |
children | d732948e6b0b |
files | busybox/stuff/busybox-1.12.0-cpio-mkdir.u |
line diff
1.1 --- a/busybox/stuff/busybox-1.12.0-cpio-mkdir.u Sat Oct 25 10:50:48 2008 +0000 1.2 +++ b/busybox/stuff/busybox-1.12.0-cpio-mkdir.u Sat Oct 25 12:09:31 2008 +0000 1.3 @@ -19,3 +19,32 @@ 1.4 && !(archive_handle->ah_flags & ARCHIVE_EXTRACT_QUIET) 1.5 ) { 1.6 bb_perror_msg("cannot make dir %s", file_header->name); 1.7 + 1.8 +--- busybox-1.12.0/archival/cpio.c 1.9 ++++ busybox-1.12.0/archival/cpio.c 1.10 +@@ -30,6 +30,7 @@ 1.11 + * It's ok to exit instead of return. */ 1.12 + static int cpio_o(void) 1.13 + { 1.14 ++ static char trailer[] = "TRAILER!!!"; 1.15 + struct name_s { 1.16 + struct name_s *next; 1.17 + char name[1]; 1.18 +@@ -119,7 +120,7 @@ 1.19 + } else { 1.20 + /* If no (more) hardlinks to output, 1.21 + * output "trailer" entry */ 1.22 +- name = "TRAILER!!!"; 1.23 ++ name = trailer; 1.24 + /* st.st_size == 0 is a must, but for uniformity 1.25 + * in the output, we zero out everything */ 1.26 + memset(&st, 0, sizeof(st)); 1.27 +@@ -167,7 +168,7 @@ 1.28 + } 1.29 + 1.30 + if (!line) { 1.31 +- if (links) 1.32 ++ if (name != trailer) 1.33 + goto next_link; 1.34 + /* TODO: GNU cpio pads trailer to 512 bytes, do we want that? */ 1.35 + return EXIT_SUCCESS;