summaryrefslogtreecommitdiff
path: root/src/common/showmsg.c
diff options
context:
space:
mode:
authorFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-11-22 23:54:34 +0000
committerFlavioJS <FlavioJS@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-11-22 23:54:34 +0000
commit1bb03e1549a9050049bc027566a448a530298b64 (patch)
tree608261af5fedb40990629bf14a434b918afe470b /src/common/showmsg.c
parent69fc1bcd69e4094d5e232acabf2a19376395d501 (diff)
downloadhercules-1bb03e1549a9050049bc027566a448a530298b64.tar.gz
hercules-1bb03e1549a9050049bc027566a448a530298b64.tar.bz2
hercules-1bb03e1549a9050049bc027566a448a530298b64.tar.xz
hercules-1bb03e1549a9050049bc027566a448a530298b64.zip
* Hunted down improper uses of va_list variables.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13383 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common/showmsg.c')
-rw-r--r--src/common/showmsg.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/common/showmsg.c b/src/common/showmsg.c
index c50716bed..fc1badd26 100644
--- a/src/common/showmsg.c
+++ b/src/common/showmsg.c
@@ -673,6 +673,7 @@ char timestamp_format[20] = ""; //For displaying Timestamps
int _vShowMessage(enum msg_type flag, const char *string, va_list ap)
{
+ va_list apcopy;
char prefix[100];
#if defined(DEBUGLOGMAP) || defined(DEBUGLOGCHAR) || defined(DEBUGLOGLOGIN)
FILE *fp;
@@ -734,12 +735,16 @@ int _vShowMessage(enum msg_type flag, const char *string, va_list ap)
if (flag == MSG_ERROR || flag == MSG_FATALERROR || flag == MSG_SQL)
{ //Send Errors to StdErr [Skotlex]
FPRINTF(STDERR, "%s ", prefix);
- VFPRINTF(STDERR, string, ap);
+ va_copy(apcopy, ap);
+ VFPRINTF(STDERR, string, apcopy);
+ va_end(apcopy);
FFLUSH(STDERR);
} else {
if (flag != MSG_NONE)
FPRINTF(STDOUT, "%s ", prefix);
- VFPRINTF(STDOUT, string, ap);
+ va_copy(apcopy, ap);
+ VFPRINTF(STDOUT, string, apcopy);
+ va_end(apcopy);
FFLUSH(STDOUT);
}
@@ -751,7 +756,9 @@ int _vShowMessage(enum msg_type flag, const char *string, va_list ap)
FFLUSH(STDERR);
} else {
fprintf(fp,"%s ", prefix);
- vfprintf(fp,string,ap);
+ va_copy(apcopy, ap);
+ vfprintf(fp,string,apcopy);
+ va_end(apcopy);
fclose(fp);
}
} else {
@@ -760,7 +767,6 @@ int _vShowMessage(enum msg_type flag, const char *string, va_list ap)
}
#endif
- va_end(ap);
return 0;
}