svn commit: r209406 - stable/7/contrib/cpio/src

Xin LI delphij at FreeBSD.org
Mon Jun 21 22:54:49 UTC 2010


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)
 {


More information about the svn-src-all mailing list