wok-stable view busybox/stuff/busybox-1.12.0-cpio-mkdir.u @ rev 1641
busybox: fix cpio TRAILER!!! with hard links
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Oct 25 12:09:31 2008 +0000 (2008-10-25) |
parents | 8a7fbe920ac6 |
children |
line source
1 --- busybox-1.12.0/archival/libunarchive/data_extract_all.c
2 +++ busybox-1.12.0/archival/libunarchive/data_extract_all.c
3 @@ -38,7 +38,8 @@ void FAST_FUNC data_extract_all(archive_
4 }
5 }
6 else if (statbuf.st_mtime <= file_header->mtime) {
7 - if (!(archive_handle->ah_flags & ARCHIVE_EXTRACT_QUIET)) {
8 + if (!(archive_handle->ah_flags & ARCHIVE_EXTRACT_QUIET) &&
9 + (file_header->mode & S_IFMT) != S_IFDIR) {
10 bb_error_msg("%s not created: newer or "
11 "same age file exists", file_header->name);
12 }
13 @@ -77,7 +78,7 @@ void FAST_FUNC data_extract_all(archive_
14 }
15 case S_IFDIR:
16 res = mkdir(file_header->name, file_header->mode);
17 - if ((res == -1) && (errno != EISDIR)
18 + if ((res == -1) && (errno != EISDIR) && (errno != EEXIST)
19 && !(archive_handle->ah_flags & ARCHIVE_EXTRACT_QUIET)
20 ) {
21 bb_perror_msg("cannot make dir %s", file_header->name);
23 --- busybox-1.12.0/archival/cpio.c
24 +++ busybox-1.12.0/archival/cpio.c
25 @@ -30,6 +30,7 @@
26 * It's ok to exit instead of return. */
27 static int cpio_o(void)
28 {
29 + static char trailer[] = "TRAILER!!!";
30 struct name_s {
31 struct name_s *next;
32 char name[1];
33 @@ -119,7 +120,7 @@
34 } else {
35 /* If no (more) hardlinks to output,
36 * output "trailer" entry */
37 - name = "TRAILER!!!";
38 + name = trailer;
39 /* st.st_size == 0 is a must, but for uniformity
40 * in the output, we zero out everything */
41 memset(&st, 0, sizeof(st));
42 @@ -167,7 +168,7 @@
43 }
45 if (!line) {
46 - if (links)
47 + if (name != trailer)
48 goto next_link;
49 /* TODO: GNU cpio pads trailer to 512 bytes, do we want that? */
50 return EXIT_SUCCESS;