mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
win32: g_getenv() should return "" if variable exists and empty
On Windows, GetEnvironmentVariable() returns 0 for empty variables. Checking GetLastError() == ERROR_ENVVAR_NOT_FOUND helps make a difference between a variable that does not exist or an empty one which should return "". https://bugzilla.gnome.org/show_bug.cgi?id=679617
This commit is contained in:
parent
6007a4b0b1
commit
bfbfbec91e
@ -466,7 +466,11 @@ g_getenv (const gchar *variable)
|
|||||||
if (len == 0)
|
if (len == 0)
|
||||||
{
|
{
|
||||||
g_free (wname);
|
g_free (wname);
|
||||||
|
if (GetLastError () == ERROR_ENVVAR_NOT_FOUND)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
quark = g_quark_from_static_string ("");
|
||||||
|
return g_quark_to_string (quark);
|
||||||
}
|
}
|
||||||
else if (len == 1)
|
else if (len == 1)
|
||||||
len = 2;
|
len = 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user