Per previous patch, win32 required the check for admin privs to be moved
from main.c into postmaster.c, because elog was not available at this
time. While working on fixing that all the way (moving the unix one as
well), I realised this wasn't good, and did it this way instead:
* 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.
* This also removes postmaster_error(), since it's mostly duplicate code
with write_stderr().
This patch implements this, as well as adds the win32 check for admin
privs to main.c. Attached file security.c goes in backend/port/win32.
The patch makes the "if user is admin" check on win32 abort startup,
similar to unix. I know several people have said they think this is
wrong, since the last discussion. So if someone wants to re-open that
discussion, go ahead :-) The behaviour can easily be adapted (just
remove an exit(1) at a later date changing the message to a warning).
//Magnus
<<stderr.patch>>