From 0cf7650c03a1ec382b2e8c13c62a873c82061095 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pawe=C5=82=20Sikora?= Date: Sun, 10 Apr 2005 21:33:49 +0000 Subject: [PATCH] - reduce stack usage, to avoid random sigsegv (catched on ac/th-athlon). Changed files: rpm-reduce-stack-usage.patch -> 1.1 --- rpm-reduce-stack-usage.patch | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 rpm-reduce-stack-usage.patch diff --git a/rpm-reduce-stack-usage.patch b/rpm-reduce-stack-usage.patch new file mode 100644 index 0000000..a05fe4c --- /dev/null +++ b/rpm-reduce-stack-usage.patch @@ -0,0 +1,48 @@ +--- rpm-4.4.1/rpmio/macro.c.orig 2005-01-26 04:39:58.000000000 +0100 ++++ rpm-4.4.1/rpmio/macro.c 2005-04-10 23:25:02.000000000 +0200 +@@ -924,7 +924,8 @@ + /*@globals rpmGlobalMacroContext @*/ + /*@modifies mb, rpmGlobalMacroContext @*/ + { +- char buf[BUFSIZ], *b, *be; ++ static char buf[BUFSIZ]; ++ char *b, *be; + char aname[16]; + const char *opts, *o; + int argc = 0; +@@ -1827,7 +1828,7 @@ + return 0; + if (mc == NULL) mc = rpmGlobalMacroContext; + +- tbuf = alloca(slen + 1); ++ tbuf = xmalloc(slen + 1); + memset(tbuf, 0, (slen + 1)); + + mb->s = sbuf; +@@ -1847,6 +1848,7 @@ + + tbuf[slen] = '\0'; /* XXX just in case */ + strncpy(sbuf, tbuf, (slen - mb->nb + 1)); ++ free(tbuf); + + return rc; + } +@@ -2091,7 +2093,8 @@ + char * + rpmExpand(const char *arg, ...) + { +- char buf[BUFSIZ], *p, *pe; ++ static char buf[BUFSIZ]; ++ char *p, *pe; + const char *s; + va_list ap; + +@@ -2229,7 +2232,7 @@ + const char * + rpmGetPath(const char *path, ...) + { +- char buf[BUFSIZ]; ++ static char buf[BUFSIZ]; + const char * s; + char * t, * te; + va_list ap; -- 2.44.0