Переглянути джерело

take over Debian bugfix (hopefully va_copy is portable enough)

Ralf S. Engelschall 21 роки тому
батько
коміт
905728b12e
2 змінених файлів з 31 додано та 1 видалено
  1. 28 0
      gift/gift.patch
  2. 3 1
      gift/gift.spec

+ 28 - 0
gift/gift.patch

@@ -0,0 +1,28 @@
+Index: lib/strobj.c
+--- lib/strobj.c.orig	2003-12-23 05:22:53.000000000 +0100
++++ lib/strobj.c	2004-05-21 09:44:36.000000000 +0200
+@@ -165,6 +165,7 @@
+ 
+ int string_appendvf (String *sobj, const char *fmt, va_list args)
+ {
++	va_list args_cpy;
+ 	int written = 0;
+ 
+ 	if (!sobj)
+@@ -186,7 +187,15 @@
+ 		{
+ 			max = sobj->alloc - sobj->len;
+ 
+-			written = vsnprintf (sobj->str + sobj->len, max, fmt, args);
++			/*
++			 * We have to make a copy of the va_list because we may pass this
++			 * point multiple times. Note that simply calling va_start again is
++			 * not a good idea since the va_start/va_end should be in the same
++			 * stack frame because of some obscure implementations.
++			 */
++			va_copy (args_cpy, args);
++			written = vsnprintf (sobj->str + sobj->len, max, fmt, args_cpy);
++			va_end (args_cpy);
+ 
+ 			/*
+ 			 * Some implementations use -1 to indicate an inability to write

+ 3 - 1
gift/gift.spec

@@ -34,7 +34,7 @@ Class:        EVAL
 Group:        Network
 License:      GPL
 Version:      0.11.6
-Release:      20040520
+Release:      20040521
 
 #   package options
 %option       with_imagemagick  yes
@@ -42,6 +42,7 @@ Release:      20040520
 
 #   list of sources
 Source0:      http://osdn.dl.sourceforge.net/gift/gift-%{version}.tar.bz2
+Patch0:       gift.patch
 
 #   build information
 Prefix:       %{l_prefix}
@@ -77,6 +78,7 @@ AutoReqProv:  no
 
 %prep
     %setup -q
+    %patch -p0
 
 %build
     CC="%{l_cc}" \