Search Postgresql Archives

Re: [HACKERS] query log corrupted-looking entries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tom Lane wrote:
> I checked around with some kernel/glibc gurus in Red Hat, and the
> consensus seemed to be that we'd be better off to bypass fprintf() and
> just send message strings to stderr using write() --- ie, instead of
> elog.c doing
> 
>             fprintf(stderr, "%s", buf.data);
> 
> do
> 
>             write(fileno(stderr), buf.data, strlen(buf.data));
> 
> Anyone have any comments on possible portability risks?  In 
> particular, will this work on Windows?

The following program compiles and runs fine:

#include <stdio.h>
#include <unistd.h>
#include <string.h>

int main(int argc, char **argv) {
        const char *s="Hello!\n";

        write(fileno(stderr), s, strlen(s));
        return 0;
}

Yours,
Laurenz Albe


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux