From: Bob Toxen <bob@roger.realminfo.com>
To: linuxppc-dev@lists.linuxppc.org
Subject: Nested stdarg broken?
Date: Tue, 26 Oct 1999 19:03:25 -0400 [thread overview]
Message-ID: <199910262303.TAA26743@roger.realminfo.com> (raw)
My application uses stdarg (#include <stdarg.h>, va_start, and friends)
in a function that then calls vfprintf which also uses stdarg.
The variable args get garbled by the time they get to vfprintf. The
fmt arg does not get garbled.
Note that the documentation specifies that this should work. My application
works fine on Linux on Intel and other platforms. The PowerPC is the first
big endian platform but I am quite sure that the bug is not in my code.
My code (simplified) looks like
#include <stdio.h>
#include <stdarg.h>
logmsg(int out, const char *fmt, ...)
{
FILE *fp;
char *p;
int ret = 0;
char buf[512];
va_list ap; /* May need to be last arg. */
va_start(ap, fmt);
fflush(stdout); /* Flush "the other" output. */
fp = fopen(logfile, "a");
if (!fp || vfprintf(fp, fmt, ap) < 1)
ret = -1;
if (fp && fclose(fp) == EOF)
ret = -1;
va_end(ap);
return ret;
}
THANKS for any insight. Presently I'm IFDEFing it to not use stdargs on
the PowerPC platform.
Bob Toxen
bob@roger.realminfo.com
Error #152, Windows not found: (C)heer, (P)arty, (D)ance
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
next reply other threads:[~1999-10-26 23:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-10-26 23:03 Bob Toxen [this message]
1999-10-27 6:08 ` Nested stdarg broken? Momchil 'Velco' Velikov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199910262303.TAA26743@roger.realminfo.com \
--to=bob@roger.realminfo.com \
--cc=linuxppc-dev@lists.linuxppc.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).