win32env.c bug with no msvcrt

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: win32env.c bug with no msvcrt
Date: 2009-12-23 12:36:14
Message-ID: 9837222c0912230436j324765e4l53061f0c0150b426@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

There is code in src/port/win32env.c to update the environment within
the msvcrt.dll runtime even when running in msvcr70.dll (visual C++
2005). It updates that one, the local one *and* the system
environment.

However, in case there is no msvcrt.dll linked into the process, it
will abort at that stage and *not* update the system or local
environment. This happens during my tests on Visual Studio 2008, and
it causes the regression tests to fail (since they set environment
variables for subprocesses - thus needing the system env update)

The attached patch changes this to just ignore failure to find
msvcr.dll. It usually doesn't happen, because we almost always link
with third party libs that bring it in, but it can happen. Also, since
we *never* check the return code from putenv anyway, returning an
error code makes no sense...

Given that we've had zero reports of this on previous versions, I'm
not planning to backpatch this.

Comments?

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

Attachment Content-Type Size
win32env.patch application/octet-stream 970 bytes

Browse pgsql-hackers by date

  From Date Subject
Next Message Zdenek Kotala 2009-12-23 14:37:21 Re: [patch] executor and slru dtrace probes
Previous Message Heikki Linnakangas 2009-12-23 12:24:42 Re: fdw validation function vs zero catalog id