Fix bug related to printf in string functions implementation - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2011年12月20日 16:34:34 +0100
committerFrancesco Abbate <francesco.bbt@gmail.com>2011年12月20日 16:34:34 +0100
commitb61f1de6a37befa7f8cfd93c2cb21bb54a31637f (patch)
tree3376f91411505c946fb915846fb657dacf0d38e1
parent10e0c81563681a0b5db86796d3fdbbf5925ff1cd (diff)
downloadgsl-shell-b61f1de6a37befa7f8cfd93c2cb21bb54a31637f.tar.gz
Fix bug related to printf in string functions implementation
Diffstat
-rw-r--r--str.c 7
1 files changed, 6 insertions, 1 deletions
diff --git a/str.c b/str.c
index c6fc736d..e8ee1fd9 100644
--- a/str.c
+++ b/str.c
@@ -263,6 +263,9 @@ str_vprintf (str_t d, const char *fmt, int append, va_list ap)
char *xbuf;
int xbuf_size;
int ns;
+ va_list aq;
+
+ va_copy (aq, ap);
ns = vsnprintf (buffer, STR_BUFSIZE, fmt, ap);
@@ -270,7 +273,7 @@ str_vprintf (str_t d, const char *fmt, int append, va_list ap)
{
xbuf_size = ns+1;
xbuf = malloc (xbuf_size);
- vsnprintf (xbuf, xbuf_size, fmt, ap);
+ vsnprintf (xbuf, xbuf_size, fmt, aq);
}
else
{
@@ -278,6 +281,8 @@ str_vprintf (str_t d, const char *fmt, int append, va_list ap)
xbuf_size = 0;
}
+ va_end (aq);
+
if (append)
{
str_append_c (d, xbuf, 0);
generated by cgit v1.2.3 (git 2.39.1) at 2025年10月05日 21:16:04 +0000

AltStyle によって変換されたページ (->オリジナル) /