Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalware-current.git;a=commitdiff;h=3f685208c5c962e43298797ddcc578a115bc0abf

commit 3f685208c5c962e43298797ddcc578a115bc0abf
Author: Miklos Vajna <[EMAIL PROTECTED]>
Date:   Sat Nov 10 15:07:45 2007 +0100

cpio-2.9-2-i686
added cpio-2.9-safer_name_suffix.patch
closes #2570

diff --git a/source/base/cpio/FrugalBuild b/source/base/cpio/FrugalBuild
index e9d4e77..c39faeb 100644
--- a/source/base/cpio/FrugalBuild
+++ b/source/base/cpio/FrugalBuild
@@ -3,14 +3,17 @@

pkgname=cpio
pkgver=2.9
-pkgrel=1
+pkgrel=2
pkgdesc="A program to manage archives of files"
url="http://www.gnu.org/software/cpio";
depends=('bash')
groups=('base')
archs=('i686' 'x86_64' 'ppc')
Fup2gnubz2
-source=(http://ftp.gnu.org/pub/gnu/$pkgname/$pkgname-$pkgver.tar.bz2)
+source=(http://ftp.gnu.org/pub/gnu/$pkgname/$pkgname-$pkgver.tar.bz2 \
+       cpio-2.9-safer_name_suffix.patch)
+sha1sums=('ef381d0f33f1ea74475b6d813c42a74327762c4a' \
+          '0c052bd7900bc8a39b74f36feab2d2358297f87b')

build()
{
@@ -20,5 +23,3 @@ build()
}

# optimization ok
-
-sha1sums=('ef381d0f33f1ea74475b6d813c42a74327762c4a')
diff --git a/source/base/cpio/cpio-2.9-safer_name_suffix.patch 
b/source/base/cpio/cpio-2.9-safer_name_suffix.patch
new file mode 100644
index 0000000..796a999
--- /dev/null
+++ b/source/base/cpio/cpio-2.9-safer_name_suffix.patch
@@ -0,0 +1,89 @@
+diff -up tar-1.17/lib/paxnames.c.safer_name_suffix tar-1.17/lib/paxnames.c
+--- tar-1.17/lib/paxnames.c.safer_name_suffix  2005-05-22 00:55:55.000000000 
+0200
++++ tar-1.17/lib/paxnames.c    2007-10-22 17:32:54.000000000 +0200
+@@ -36,15 +36,27 @@ hash_string_compare (void const *name1,
+   return strcmp (name1, name2) == 0;
+ }
+
+-/* Return zero if TABLE contains a copy of STRING; otherwise, insert a
+-   copy of STRING to TABLE and return 1.  */
+-bool
+-hash_string_insert (Hash_table **table, char const *string)
++/* Return zero if TABLE contains a LEN-character long prefix of STRING,
++   otherwise, insert a newly allocated copy of this prefix to TABLE and
++   return 1.  If RETURN_PREFIX is not NULL, point it to the allocated
++   copy. */
++static bool
++hash_string_insert_prefix (Hash_table **table, char const *string, size_t len,
++                         const char **return_prefix)
+ {
+   Hash_table *t = *table;
+-  char *s = xstrdup (string);
++  char *s;
+   char *e;
+
++  if (len)
++    {
++      s = xmalloc (len + 1);
++      memcpy (s, string, len);
++      s[len] = 0;
++    }
++  else
++    s = xstrdup (string);
++
+   if (! ((t
+         || (*table = t = hash_initialize (0, 0, hash_string_hasher,
+                                           hash_string_compare, 0)))
+@@ -52,7 +64,11 @@ hash_string_insert (Hash_table **table,
+     xalloc_die ();
+
+   if (e == s)
+-    return 1;
++    {
++      if (return_prefix)
++      *return_prefix = s;
++      return 1;
++    }
+   else
+     {
+       free (s);
+@@ -60,6 +76,14 @@ hash_string_insert (Hash_table **table,
+     }
+ }
+
++/* Return zero if TABLE contains a copy of STRING; otherwise, insert a
++   copy of STRING to TABLE and return 1.  */
++bool
++hash_string_insert (Hash_table **table, char const *string)
++{
++  return hash_string_insert_prefix (table, string, 0, NULL);
++}
++
+ /* Return 1 if TABLE contains STRING.  */
+ bool
+ hash_string_lookup (Hash_table const *table, char const *string)
+@@ -88,7 +112,8 @@ removed_prefixes_p (void)
+    If ABSOLUTE_NAMES is 0, strip filesystem prefix from the file name. */
+
+ char *
+-safer_name_suffix (char const *file_name, bool link_target, bool 
absolute_names)
++safer_name_suffix (char const *file_name, bool link_target,
++                 bool absolute_names)
+ {
+   char const *p;
+
+@@ -121,11 +146,9 @@ safer_name_suffix (char const *file_name
+
+       if (prefix_len)
+       {
+-        char *prefix = alloca (prefix_len + 1);
+-        memcpy (prefix, file_name, prefix_len);
+-        prefix[prefix_len] = '\0';
+-
+-        if (hash_string_insert (&prefix_table[link_target], prefix))
++        const char *prefix;
++        if (hash_string_insert_prefix (&prefix_table[link_target], file_name,
++                                       prefix_len, &prefix))
+           {
+             static char const *const diagnostic[] =
+             {
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to