1 |
grobian 08/10/19 18:55:33 |
2 |
|
3 |
Modified: paxinc.c paxinc.h |
4 |
Log: |
5 |
Now I had the specs here anyway, implemented GNU extended filenames as well. |
6 |
|
7 |
Revision Changes Path |
8 |
1.10 pax-utils/paxinc.c |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/paxinc.c?rev=1.10&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/paxinc.c?rev=1.10&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/paxinc.c?r1=1.9&r2=1.10 |
13 |
|
14 |
Index: paxinc.c |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-projects/pax-utils/paxinc.c,v |
17 |
retrieving revision 1.9 |
18 |
retrieving revision 1.10 |
19 |
diff -u -r1.9 -r1.10 |
20 |
--- paxinc.c 19 Oct 2008 18:11:59 -0000 1.9 |
21 |
+++ paxinc.c 19 Oct 2008 18:55:33 -0000 1.10 |
22 |
@@ -1,7 +1,7 @@ |
23 |
/* |
24 |
* Copyright 2003-2007 Gentoo Foundation |
25 |
* Distributed under the terms of the GNU General Public License v2 |
26 |
- * $Header: /var/cvsroot/gentoo-projects/pax-utils/paxinc.c,v 1.9 2008/10/19 18:11:59 grobian Exp $ |
27 |
+ * $Header: /var/cvsroot/gentoo-projects/pax-utils/paxinc.c,v 1.10 2008/10/19 18:55:33 grobian Exp $ |
28 |
* |
29 |
* Copyright 2005-2007 Ned Ludd - <solar@g.o> |
30 |
* Copyright 2005-2007 Mike Frysinger - <vapier@g.o> |
31 |
@@ -26,6 +26,7 @@ |
32 |
ret.filename = filename; |
33 |
ret.fd = fd; |
34 |
ret.skip = 0; |
35 |
+ ret.extfn = NULL; |
36 |
|
37 |
if (read(ret.fd, buf, AR_MAGIC_SIZE) != AR_MAGIC_SIZE) |
38 |
return NULL; |
39 |
@@ -77,8 +78,20 @@ |
40 |
} |
41 |
|
42 |
if (ret.buf.formatted.name[0] == '/' && ret.buf.formatted.name[1] == '/') { |
43 |
- warn("Sorry, long names not yet supported; output will be incomplete for %s", ar->filename); |
44 |
- ar->skip = atoi(ret.buf.formatted.size); |
45 |
+ if (ar->extfn != NULL) { |
46 |
+ warn("Duplicate GNU extended filename section"); |
47 |
+ goto close_and_ret; |
48 |
+ } |
49 |
+ len = atoi(ret.buf.formatted.size); |
50 |
+ /* we will leak this memory */ |
51 |
+ ar->extfn = malloc(sizeof(char) * (len + 1)); |
52 |
+ if (read(ar->fd, ar->extfn, len) != len) |
53 |
+ goto close_and_ret; |
54 |
+ ar->extfn[len--] = '\0'; |
55 |
+ for (; len > 0; len--) |
56 |
+ if (ar->extfn[len] == '\n') |
57 |
+ ar->extfn[len] = '\0'; |
58 |
+ ar->skip = 0; |
59 |
return ar_next(ar); |
60 |
} |
61 |
|
62 |
@@ -94,6 +107,13 @@ |
63 |
if (read(ar->fd, s, len) != len) |
64 |
goto close_and_ret; |
65 |
} |
66 |
+ } else if (s[0] == '/' && s[1] >= '0' && s[1] <= '9') { |
67 |
+ /* GNU extended filename */ |
68 |
+ if (ar->extfn == NULL) { |
69 |
+ warn("GNU extended filename without special data section"); |
70 |
+ goto close_and_ret; |
71 |
+ } |
72 |
+ s = ar->extfn + atoi(s + 1); |
73 |
} |
74 |
|
75 |
snprintf(ret.name, sizeof(ret.name), "%s:%s", ar->filename, s); |
76 |
|
77 |
|
78 |
|
79 |
1.12 pax-utils/paxinc.h |
80 |
|
81 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/paxinc.h?rev=1.12&view=markup |
82 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/paxinc.h?rev=1.12&content-type=text/plain |
83 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/paxinc.h?r1=1.11&r2=1.12 |
84 |
|
85 |
Index: paxinc.h |
86 |
=================================================================== |
87 |
RCS file: /var/cvsroot/gentoo-projects/pax-utils/paxinc.h,v |
88 |
retrieving revision 1.11 |
89 |
retrieving revision 1.12 |
90 |
diff -u -r1.11 -r1.12 |
91 |
--- paxinc.h 8 Sep 2008 07:02:56 -0000 1.11 |
92 |
+++ paxinc.h 19 Oct 2008 18:55:33 -0000 1.12 |
93 |
@@ -1,7 +1,7 @@ |
94 |
/* |
95 |
* Copyright 2005-2007 Gentoo Foundation |
96 |
* Distributed under the terms of the GNU General Public License v2 |
97 |
- * $Header: /var/cvsroot/gentoo-projects/pax-utils/paxinc.h,v 1.11 2008/09/08 07:02:56 grobian Exp $ |
98 |
+ * $Header: /var/cvsroot/gentoo-projects/pax-utils/paxinc.h,v 1.12 2008/10/19 18:55:33 grobian Exp $ |
99 |
* |
100 |
* Copyright 2005-2007 Ned Ludd - <solar@g.o> |
101 |
* Copyright 2005-2007 Mike Frysinger - <vapier@g.o> |
102 |
@@ -34,6 +34,7 @@ |
103 |
int fd; |
104 |
const char *filename; |
105 |
size_t skip; |
106 |
+ char *extfn; |
107 |
} archive_handle; |
108 |
#else |
109 |
typedef void archive_handle; |