grobian 08/10/19 18:55:33
Modified: paxinc.c paxinc.h
Log:
Now I had the specs here anyway, implemented GNU extended filenames as well.
Revision Changes Path
1.10 pax-utils/paxinc.c
file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/paxinc.c?rev=1.10&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/paxinc.c?rev=1.10&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/paxinc.c?r1=1.9&r2=1.10
Index: paxinc.c
===================================================================
RCS file: /var/cvsroot/gentoo-projects/pax-utils/paxinc.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- paxinc.c 19 Oct 2008 18:11:59 -0000 1.9
+++ paxinc.c 19 Oct 2008 18:55:33 -0000 1.10
@@ -1,7 +1,7 @@
/*
* Copyright 2003-2007 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/pax-utils/paxinc.c,v 1.9 2008/10/19 18:11:59 grobian Exp $
+ * $Header: /var/cvsroot/gentoo-projects/pax-utils/paxinc.c,v 1.10 2008/10/19 18:55:33 grobian Exp $
*
* Copyright 2005-2007 Ned Ludd - <solar@g.o>
* Copyright 2005-2007 Mike Frysinger - <vapier@g.o>
@@ -26,6 +26,7 @@
ret.filename = filename;
ret.fd = fd;
ret.skip = 0;
+ ret.extfn = NULL;
if (read(ret.fd, buf, AR_MAGIC_SIZE) != AR_MAGIC_SIZE)
return NULL;
@@ -77,8 +78,20 @@
}
if (ret.buf.formatted.name[0] == '/' && ret.buf.formatted.name[1] == '/') {
- warn("Sorry, long names not yet supported; output will be incomplete for %s", ar->filename);
- ar->skip = atoi(ret.buf.formatted.size);
+ if (ar->extfn != NULL) {
+ warn("Duplicate GNU extended filename section");
+ goto close_and_ret;
+ }
+ len = atoi(ret.buf.formatted.size);
+ /* we will leak this memory */
+ ar->extfn = malloc(sizeof(char) * (len + 1));
+ if (read(ar->fd, ar->extfn, len) != len)
+ goto close_and_ret;
+ ar->extfn[len--] = '\0';
+ for (; len > 0; len--)
+ if (ar->extfn[len] == '\n')
+ ar->extfn[len] = '\0';
+ ar->skip = 0;
return ar_next(ar);
}
@@ -94,6 +107,13 @@
if (read(ar->fd, s, len) != len)
goto close_and_ret;
}
+ } else if (s[0] == '/' && s[1] >= '0' && s[1] <= '9') {
+ /* GNU extended filename */
+ if (ar->extfn == NULL) {
+ warn("GNU extended filename without special data section");
+ goto close_and_ret;
+ }
+ s = ar->extfn + atoi(s + 1);
}
snprintf(ret.name, sizeof(ret.name), "%s:%s", ar->filename, s);
1.12 pax-utils/paxinc.h
file : http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/paxinc.h?rev=1.12&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/paxinc.h?rev=1.12&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-projects/pax-utils/paxinc.h?r1=1.11&r2=1.12
Index: paxinc.h
===================================================================
RCS file: /var/cvsroot/gentoo-projects/pax-utils/paxinc.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- paxinc.h 8 Sep 2008 07:02:56 -0000 1.11
+++ paxinc.h 19 Oct 2008 18:55:33 -0000 1.12
@@ -1,7 +1,7 @@
/*
* Copyright 2005-2007 Gentoo Foundation
* Distributed under the terms of the GNU General Public License v2
- * $Header: /var/cvsroot/gentoo-projects/pax-utils/paxinc.h,v 1.11 2008/09/08 07:02:56 grobian Exp $
+ * $Header: /var/cvsroot/gentoo-projects/pax-utils/paxinc.h,v 1.12 2008/10/19 18:55:33 grobian Exp $
*
* Copyright 2005-2007 Ned Ludd - <solar@g.o>
* Copyright 2005-2007 Mike Frysinger - <vapier@g.o>
@@ -34,6 +34,7 @@
int fd;
const char *filename;
size_t skip;
+ char *extfn;
} archive_handle;
#else
typedef void archive_handle;
|