aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;