Date: Mon, 21 Jun 2010 22:54:48 +0000 (UTC) From: Xin LI <delphij@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r209406 - stable/7/contrib/cpio/src Message-ID: <201006212254.o5LMsmZD061048@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: delphij Date: Mon Jun 21 22:54:47 2010 New Revision: 209406 URL: http://svn.freebsd.org/changeset/base/209406 Log: Fix a regression when dealing with tar(1) format files introduced with GNU cpio 2.8. This is a direct commit against stable/7 because the code have been removed on -HEAD and stable/8. PR: bin/147969 Submitted by: kientzle Modified: stable/7/contrib/cpio/src/tar.c Modified: stable/7/contrib/cpio/src/tar.c ============================================================================== --- stable/7/contrib/cpio/src/tar.c Mon Jun 21 22:20:52 2010 (r209405) +++ stable/7/contrib/cpio/src/tar.c Mon Jun 21 22:54:47 2010 (r209406) @@ -32,6 +32,32 @@ /* Stash the tar linkname in static storage. */ +#undef FROM_OCTAL +#define FROM_OCTAL(f) tar_otoa(f, sizeof f) + +/* Convert the string of octal digits S into a number. + * Converted from GNU cpio 2.6 sources in + * order to fix tar breakage caused by using + * from_ascii. + */ +static unsigned long +tar_otoa(const char *where, size_t digs) +{ + const char *s = where; + const char *end = s + digs; + unsigned long val = 0; + + while (s < end && *s == ' ') + ++s; + while (s < end && *s >= '0' && *s <= '7') + val = 8 * val + *s++ - '0'; + while (s < end && (*s == ' ' || *s == '\0')) + ++s; + if (s < end) + error (0, 0, _("Malformed number %.*s"), digs, where); + return val; +} + static char * stash_tar_linkname (char *linkname) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006212254.o5LMsmZD061048>