Re: stderr & win32 admin check

Поиск
Список
Период
Сортировка
От Magnus Hagander
Тема Re: stderr & win32 admin check
Дата
Msg-id 6BCB9D8A16AC4241919521715F4D8BCE34BC6B@algol.sollentuna.se
обсуждение исходный текст
Ответ на stderr & win32 admin check  ("Magnus Hagander" <mha@sollentuna.net>)
Ответы Re: stderr & win32 admin check  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-patches
>> * Created function write_stderr(const char *fmt, ...), used
>before elog
>> can be used. This function will write to stderr on unix and on win32
>> fconsole. It will write to the eventlog on win32 when running as a
>> service.
>> * Changed all (most? I think I got all) fprintf(stderr,...)
>to use this
>> function instead. That way, we gain the ability to put all the other
>> preivously-stderr-messages to the eventlog as well.
>
>I'm not sure this is a good idea.  The remaining uses of stderr were
>that way for a reason, not because someone had forgot to change them
>into elog calls.  It would be a lot less invasive to just move the
>privilege check as you originally intended.


I figured as long as nothing "dangerous" (e.g. using memory allocations
etc) is done in the function, it should be just as safe as fprintf. On
Unix, it does nothing more than a simple fprintf anyway (one call
deeper). The only difference in practice is that we can put them in the
eventlog on win32 (again, only using calls that are safe in this
context). If we do it the other way, we are going to lose these other
messages when running as a service on win32 (since we specifically are
not using ereport(), per what you say above).

Also, this would remove the check so you could do initdb and other
operations that are blocked today (that don't go through postmaster.c)
when being root, I assumed that was not good either...

//Magnus

В списке pgsql-patches по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: stderr & win32 admin check
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: eventlog fix