Re: [msysGit] [PATCH/RFC 03/11] mingw: implement syslog
- From
Erik Faye-Lund <kusmabite@googlemail.com>
- Date
- Dec 8, 2009, 14:01 UTC
- Message-ID
- <40aa078e0912080601p3d73f8b4k469ba5229c931575@mail.gmail.com>
- In-Reply-To
- <200911272023.58262.j6t@kdbg.org>
On Fri, Nov 27, 2009 at 8:23 PM, Johannes Sixt <j6t@kdbg.org> wrote:
Show 23 quoted lines
> On Freitag, 27. November 2009, Erik Faye-Lund wrote:
>> On Thu, Nov 26, 2009 at 10:23 PM, Johannes Sixt <j6t@kdbg.org> wrote:
>> > I would
>> >
>> > const char* arg;
>> > if (strcmp(fmt, "%s"))
>> > die("format string of syslog() not implemented")
>> > va_start(va, fmt);
>> > arg = va_arg(va, char*);
>> > va_end(va);
>> >
>> > because we have exactly one invocation of syslog(), which passes "%s" as
>> > format string. Then strbuf_vaddf is not needed. Or even simpler: declare
>> > the function as
>> >
>> > void syslog(int priority, const char *fmt, const char*arg);
>>
>> After reading this again, I agree that this is the best solution. I'll
>> update for the next iteration.
>
> Except that you shouldn't die like I proposed because here we are already in
> the die_routine, no?
>Might be. Either way, I think loosing a log-entry is better than taking down the server. I'm just doing a warning() and return. If we're lucky, the warning gets somewhere. If not, well, something happened and no one was around to see it.
Show 12 quoted lines
>> > "Note that the string that you log cannot contain %n, where n is an >> > integer value (for example, %1) because the event viewer treats it as an >> > insertion string. ..." >> > >> > How are the chances that this condition applies to our use of the >> > function? >> >> Ugh, increasingly high since we're adding IPv6 support, I guess. >> Perhaps some form of escaping needs to be done? > > I think so, but actually I have no clue. >
Bah, according to Microsoft Support (1), there's no simple way to escape this. I'm tempted to leave this bug in, and rather try to fix the symptoms when/if they start popping up. Unless someone else comes up with something better, that is.
(1) http://support.microsoft.com/kb/934640
-- Erik "kusma" Faye-Lund