Avoid a g_critical(). Pass a large enough result buffer to

2008-09-30  Tor Lillqvist  <tml@novell.com>

	* glocalfile.c (get_volume_for_path) [Win32]: Avoid a
	g_critical(). Pass a large enough result buffer to
	GetVolumePathNameW(). Just use MAX_PATH.


svn path=/branches/glib-2-18/; revision=7560
This commit is contained in:
Tor Lillqvist 2008-09-30 10:45:43 +00:00 committed by Tor Lillqvist
parent 0770dc066a
commit a50c5f5b98
2 changed files with 9 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2008-09-30 Tor Lillqvist <tml@novell.com>
* glocalfile.c (get_volume_for_path) [Win32]: Avoid a
g_critical(). Pass a large enough result buffer to
GetVolumePathNameW(). Just use MAX_PATH.
2008-09-20 Matthias Clasen <mclasen@redhat.com>
Merged from trunk:

View File

@ -844,10 +844,10 @@ get_volume_for_path (const char *path)
wchar_t *wpath;
wchar_t *result;
wpath = g_utf8_to_utf16 (path, -1, NULL, &len, NULL);
result = g_new (wchar_t, len + 2);
wpath = g_utf8_to_utf16 (path, -1, NULL, NULL, NULL);
result = g_new (wchar_t, MAX_PATH);
if (!GetVolumePathNameW (wpath, result, len + 2))
if (!GetVolumePathNameW (wpath, result, MAX_PATH))
{
char *msg = g_win32_error_message (GetLastError ());
g_critical ("GetVolumePathName failed: %s", msg);