Bug 660730: Use GStatBuf for portability

Thanks to Kean Johnston for pointing this out.

There are a few places in GTK that use "struct stat",
and then g_stat(), rather than using GStatBuf.This breaks things on
Windows. Since the size of struct stat can vary depending on other
flags specified, this has the potential to cause overwrites and is
trivial to fix.

Based on patch submitted by Kean Johnston
This commit is contained in:
Chun-wei Fan
2011-10-03 23:25:33 +08:00
parent 25e65dc1b5
commit eb8c2dfae2
4 changed files with 17 additions and 12 deletions

View File

@ -2037,7 +2037,7 @@ gboolean
gtk_recent_info_exists (GtkRecentInfo *info)
{
gchar *filename;
struct stat stat_buf;
GStatBuf stat_buf;
gboolean retval = FALSE;
g_return_val_if_fail (info != NULL, FALSE);
@ -2049,7 +2049,7 @@ gtk_recent_info_exists (GtkRecentInfo *info)
filename = g_filename_from_uri (info->uri, NULL, NULL);
if (filename)
{
if (stat (filename, &stat_buf) == 0)
if (g_stat (filename, &stat_buf) == 0)
retval = TRUE;
g_free (filename);