From owner-svn-src-all@FreeBSD.ORG Mon Jun 21 22:54:49 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C699106568A; Mon, 21 Jun 2010 22:54:49 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0B1578FC08; Mon, 21 Jun 2010 22:54:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o5LMsm7O061050; Mon, 21 Jun 2010 22:54:48 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o5LMsmZD061048; Mon, 21 Jun 2010 22:54:48 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201006212254.o5LMsmZD061048@svn.freebsd.org> From: Xin LI Date: Mon, 21 Jun 2010 22:54:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r209406 - stable/7/contrib/cpio/src X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Jun 2010 22:54:49 -0000 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) {