# HG changeset patch # User Pascal Bellard # Date 1224936571 0 # Node ID d84c7ed6eeb4cdc040ebc4e39b09ea2d38bbd761 # Parent 8c8ce3310a17b5c7e9eeb8089a7714406c43665e busybox: fix cpio TRAILER!!! with hard links diff -r 8c8ce3310a17 -r d84c7ed6eeb4 busybox/stuff/busybox-1.12.0-cpio-mkdir.u --- a/busybox/stuff/busybox-1.12.0-cpio-mkdir.u Sat Oct 25 10:50:48 2008 +0000 +++ b/busybox/stuff/busybox-1.12.0-cpio-mkdir.u Sat Oct 25 12:09:31 2008 +0000 @@ -19,3 +19,32 @@ && !(archive_handle->ah_flags & ARCHIVE_EXTRACT_QUIET) ) { bb_perror_msg("cannot make dir %s", file_header->name); + +--- busybox-1.12.0/archival/cpio.c ++++ busybox-1.12.0/archival/cpio.c +@@ -30,6 +30,7 @@ + * It's ok to exit instead of return. */ + static int cpio_o(void) + { ++ static char trailer[] = "TRAILER!!!"; + struct name_s { + struct name_s *next; + char name[1]; +@@ -119,7 +120,7 @@ + } else { + /* If no (more) hardlinks to output, + * output "trailer" entry */ +- name = "TRAILER!!!"; ++ name = trailer; + /* st.st_size == 0 is a must, but for uniformity + * in the output, we zero out everything */ + memset(&st, 0, sizeof(st)); +@@ -167,7 +168,7 @@ + } + + if (!line) { +- if (links) ++ if (name != trailer) + goto next_link; + /* TODO: GNU cpio pads trailer to 512 bytes, do we want that? */ + return EXIT_SUCCESS;