Mailinglist Archive: opensuse-programming (9 mails)

< Previous Next >
Re: [opensuse-programming] any problems with vsyslog on 64bit systems?
  • From: Marcus Meissner <meissner@xxxxxxx>
  • Date: Tue, 26 Feb 2008 22:17:09 +0100
  • Message-id: <20080226211709.GC10351@xxxxxxx>
I sure hope I'm using it right - don't want to make myself look stupid
in public:


va_start( v, format );

// if we're not running as a daemon, we also log stdout.
if ( 0==get_daemonize() )
{
vfprintf( stdout, format, v ); // FIRST USE
fputc( '\n', stdout );
}
vsyslog( pri, format, v ); // SECOND USE

va_end(v);

No, you are using the va_list _twice_.
You can do that on i386 perhaps, but not on x86_64, it will just crash.

Use va_copy (v2, v); to get a second list, and pass this to vfprintf().

Perhaps try:
va_list v2;

va_start ( v, format );

if 0==get_daemonize())
{
va_copy (v2, v);
vfprintf ( stdout, format , v2);
fputc ('\n', stdout);
va_end (v2);
}
vsyslog( pri, format, v ); // SECOND USE
va_end(v);
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-programming+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-programming+help@xxxxxxxxxxxx

< Previous Next >
List Navigation