summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko2008-10-26 19:55:20 +0000
committerDenis Vlasenko2008-10-26 19:55:20 +0000
commitc503dde01a3be1ddabf3a3bcc1d1074457cf5f1a (patch)
tree45e2058425c9d4f9db907fa5ca8341a7765e3af5
parent6b9d6c7544b5edf79365ef3cb5b37359538c31dd (diff)
downloadbusybox-c503dde01a3be1ddabf3a3bcc1d1074457cf5f1a.zip
busybox-c503dde01a3be1ddabf3a3bcc1d1074457cf5f1a.tar.gz
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 b447b27..1c30d89 100644
--- a/archival/cpio.c
+++ b/archival/cpio.c
@@ -30,6 +30,7 @@ static off_t cpio_pad4(off_t size)
* It's ok to exit instead of return. */
static int cpio_o(void)
{
+ static const char trailer[] ALIGN1 = "TRAILER!!!";
struct name_s {
struct name_s *next;
char name[1];
@@ -119,7 +120,7 @@ static int cpio_o(void)
} 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 @@ static int cpio_o(void)
}
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;