svn commit: trunk/busybox/archival

vda at busybox.net vda at busybox.net
Sun Oct 26 19:55:20 UTC 2008


Author: vda
Date: 2008-10-26 12:55:20 -0700 (Sun, 26 Oct 2008)
New Revision: 23804

Log:
cpio: emit TRAILER even when hard links were found.
 by Pascal Bellard (pascal.bellard AT ads-lu.com)



Modified:
   trunk/busybox/archival/cpio.c


Changeset:
Modified: trunk/busybox/archival/cpio.c
===================================================================
--- trunk/busybox/archival/cpio.c	2008-10-26 19:07:43 UTC (rev 23803)
+++ trunk/busybox/archival/cpio.c	2008-10-26 19:55:20 UTC (rev 23804)
@@ -30,6 +30,7 @@
  * 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 @@
 			} 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;




More information about the busybox-cvs mailing list