aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-10-26 19:55:20 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-10-26 19:55:20 +0000
commitc503dde01a3be1ddabf3a3bcc1d1074457cf5f1a (patch)
tree45e2058425c9d4f9db907fa5ca8341a7765e3af5
parent6b9d6c7544b5edf79365ef3cb5b37359538c31dd (diff)
downloadbusybox-w32-c503dde01a3be1ddabf3a3bcc1d1074457cf5f1a.tar.gz
busybox-w32-c503dde01a3be1ddabf3a3bcc1d1074457cf5f1a.tar.bz2
busybox-w32-c503dde01a3be1ddabf3a3bcc1d1074457cf5f1a.zip
cpio: emit TRAILER even when hard links were found.
by Pascal Bellard (pascal.bellard AT ads-lu.com)
-rw-r--r--archival/cpio.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/archival/cpio.c b/archival/cpio.c
index b447b27e4..1c30d89a8 100644
--- a/archival/cpio.c
+++ b/archival/cpio.c
@@ -30,6 +30,7 @@ static off_t cpio_pad4(off_t size)
30 * It's ok to exit instead of return. */ 30 * It's ok to exit instead of return. */
31static int cpio_o(void) 31static int cpio_o(void)
32{ 32{
33 static const char trailer[] ALIGN1 = "TRAILER!!!";
33 struct name_s { 34 struct name_s {
34 struct name_s *next; 35 struct name_s *next;
35 char name[1]; 36 char name[1];
@@ -119,7 +120,7 @@ static int cpio_o(void)
119 } else { 120 } else {
120 /* If no (more) hardlinks to output, 121 /* If no (more) hardlinks to output,
121 * output "trailer" entry */ 122 * output "trailer" entry */
122 name = "TRAILER!!!"; 123 name = trailer;
123 /* st.st_size == 0 is a must, but for uniformity 124 /* st.st_size == 0 is a must, but for uniformity
124 * in the output, we zero out everything */ 125 * in the output, we zero out everything */
125 memset(&st, 0, sizeof(st)); 126 memset(&st, 0, sizeof(st));
@@ -167,7 +168,7 @@ static int cpio_o(void)
167 } 168 }
168 169
169 if (!line) { 170 if (!line) {
170 if (links) 171 if (name != trailer)
171 goto next_link; 172 goto next_link;
172 /* TODO: GNU cpio pads trailer to 512 bytes, do we want that? */ 173 /* TODO: GNU cpio pads trailer to 512 bytes, do we want that? */
173 return EXIT_SUCCESS; 174 return EXIT_SUCCESS;