diff -ru gtk+-2.24.31a/demos/pixbuf-init.c gtk+-2.24.31b/demos/pixbuf-init.c
--- gtk+-2.24.31a/demos/pixbuf-init.c	2015-12-28 16:42:28.000000000 +0100
+++ gtk+-2.24.31b/demos/pixbuf-init.c	2017-09-16 22:43:46.203313000 +0200
@@ -1,15 +1,13 @@
 #include "config.h"
 #include <glib.h>
-
-#include <sys/stat.h>
-#include <stdlib.h>
+#include <glib/gstdio.h>
 
 static gboolean
 file_exists (const char *filename)
 {
-  struct stat statbuf;
+  GStatBuf statbuf;
 
-  return stat (filename, &statbuf) == 0;
+  return g_stat (filename, &statbuf) == 0;
 }
 
 void
diff -ru gtk+-2.24.31a/gtk/gtkfilesel.c gtk+-2.24.31b/gtk/gtkfilesel.c
--- gtk+-2.24.31a/gtk/gtkfilesel.c	2015-12-28 16:42:28.000000000 +0100
+++ gtk+-2.24.31b/gtk/gtkfilesel.c	2017-09-16 23:34:08.931696400 +0200
@@ -325,7 +325,7 @@
 					    CompletionState* cmpl_state);
 #ifndef G_PLATFORM_WIN32
 static gboolean       check_dir            (gchar *dir_name, 
-					    struct stat *result, 
+					    GStatBuf *result, 
 					    gboolean *stat_subdirs);
 #endif
 static CompletionDir* open_dir             (gchar* dir_name,
@@ -337,11 +337,11 @@
 static CompletionDir* open_relative_dir    (gchar* dir_name, CompletionDir* dir,
 					    CompletionState *cmpl_state);
 static CompletionDirSent* open_new_dir     (gchar* dir_name, 
-					    struct stat* sbuf,
+					    GStatBuf *sbuf,
 					    gboolean stat_subdirs);
 static gint           correct_dir_fullname (CompletionDir* cmpl_dir);
 static gint           correct_parent       (CompletionDir* cmpl_dir,
-					    struct stat *sbuf);
+					    GStatBuf *sbuf);
 #ifndef G_PLATFORM_WIN32
 static gchar*         find_parent_dir_fullname    (gchar* dirname);
 #endif
@@ -2984,9 +2984,9 @@
 
 /* after the cache lookup fails, really open a new directory */
 static CompletionDirSent*
-open_new_dir (gchar       *dir_name,
-	      struct stat *sbuf,
-	      gboolean     stat_subdirs)
+open_new_dir (gchar    *dir_name,
+	      GStatBuf *sbuf,
+	      gboolean  stat_subdirs)
 {
   CompletionDirSent *sent;
   GDir *directory;
@@ -2995,7 +2995,7 @@
   gint entry_count = 0;
   gint n_entries = 0;
   gint i;
-  struct stat ent_sbuf;
+  GStatBuf ent_sbuf;
   GString *path;
   gchar *sys_dir_name;
 
@@ -3101,9 +3101,9 @@
 #ifndef G_PLATFORM_WIN32
 
 static gboolean
-check_dir (gchar       *dir_name,
-	   struct stat *result,
-	   gboolean    *stat_subdirs)
+check_dir (gchar    *dir_name,
+	   GStatBuf *result,
+	   gboolean *stat_subdirs)
 {
   /* A list of directories that we know only contain other directories.
    * Trying to stat every file in these directories would be very
@@ -3113,7 +3113,7 @@
   static struct {
     const gchar name[5];
     gboolean present;
-    struct stat statbuf;
+    GStatBuf statbuf;
   } no_stat_dirs[] = {
     { "/afs", FALSE, { 0 } },
     { "/net", FALSE, { 0 } }
@@ -3172,7 +3172,7 @@
 	  CompletionState *cmpl_state)
 {
 #ifndef G_PLATFORM_WIN32
-  struct stat sbuf;
+  GStatBuf sbuf;
   gboolean stat_subdirs;
   GList* cdsl;
 #endif
@@ -3238,7 +3238,7 @@
   gint length = strlen (cmpl_dir->fullname);
   gchar *first_slash = strchr (cmpl_dir->fullname, G_DIR_SEPARATOR);
   gchar *sys_filename;
-  struct stat sbuf;
+  GStatBuf sbuf;
 
   /* Does it end with /. (\.) ? */
   if (length >= 2 &&
@@ -3338,9 +3338,9 @@
 
 static gint
 correct_parent (CompletionDir *cmpl_dir,
-		struct stat   *sbuf)
+		GStatBuf      *sbuf)
 {
-  struct stat parbuf;
+  GStatBuf parbuf;
   gchar *last_slash;
   gchar *first_slash;
 #ifndef G_PLATFORM_WIN32
diff -ru gtk+-2.24.31a/gtk/gtkiconcache.c gtk+-2.24.31b/gtk/gtkiconcache.c
--- gtk+-2.24.31a/gtk/gtkiconcache.c	2016-03-05 16:59:55.000000000 +0100
+++ gtk+-2.24.31b/gtk/gtkiconcache.c	2017-09-16 21:24:50.228617500 +0200
@@ -92,8 +92,8 @@
 
   gchar *cache_filename;
   gint fd = -1;
-  struct stat st;
-  struct stat path_st;
+  GStatBuf st;
+  GStatBuf path_st;
   CacheInfo info;
 
    /* Check if we have a cache file */
diff -ru gtk+-2.24.31a/gtk/gtkicontheme.c gtk+-2.24.31b/gtk/gtkicontheme.c
--- gtk+-2.24.31a/gtk/gtkicontheme.c	2016-01-19 20:03:55.000000000 +0100
+++ gtk+-2.24.31b/gtk/gtkicontheme.c	2017-09-16 21:24:50.247108900 +0200
@@ -902,7 +902,7 @@
   GKeyFile *theme_file;
   GError *error = NULL;
   IconThemeDirMtime *dir_mtime;
-  struct stat stat_buf;
+  GStatBuf stat_buf;
   
   priv = icon_theme->priv;
 
@@ -1052,7 +1052,7 @@
   IconSuffix old_suffix, new_suffix;
   GTimeVal tv;
   IconThemeDirMtime *dir_mtime;
-  struct stat stat_buf;
+  GStatBuf stat_buf;
   
   priv = icon_theme->priv;
 
@@ -1898,7 +1898,7 @@
   IconThemeDirMtime *dir_mtime;
   GList *d;
   int stat_res;
-  struct stat stat_buf;
+  GStatBuf stat_buf;
   GTimeVal tv;
 
   priv = icon_theme->priv;
diff -ru gtk+-2.24.31a/gtk/gtkrc.c gtk+-2.24.31b/gtk/gtkrc.c
--- gtk+-2.24.31a/gtk/gtkrc.c	2015-12-28 16:42:28.000000000 +0100
+++ gtk+-2.24.31b/gtk/gtkrc.c	2017-09-16 21:24:50.705084100 +0200
@@ -983,7 +983,7 @@
 			       gboolean      reload)
 {
   GtkRcFile *rc_file;
-  struct stat statbuf;
+  GStatBuf statbuf;
   gint saved_priority;
 
   g_return_if_fail (filename != NULL);
@@ -1764,7 +1764,7 @@
   GtkRcFile *rc_file;
   GSList *tmp_list;
   GtkRcContext *context;
-  struct stat statbuf;
+  GStatBuf statbuf;
 
   g_return_val_if_fail (GTK_IS_SETTINGS (settings), FALSE);
 
diff -ru gtk+-2.24.31a/gtk/gtkrecentmanager.c gtk+-2.24.31b/gtk/gtkrecentmanager.c
--- gtk+-2.24.31a/gtk/gtkrecentmanager.c	2015-12-28 16:42:28.000000000 +0100
+++ gtk+-2.24.31b/gtk/gtkrecentmanager.c	2017-09-16 21:34:52.756083100 +0200
@@ -2184,7 +2184,7 @@
 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);
@@ -2196,7 +2196,7 @@
   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);
diff -ru gtk+-2.24.31a/gtk/gtksearchenginesimple.c gtk+-2.24.31b/gtk/gtksearchenginesimple.c
--- gtk+-2.24.31a/gtk/gtksearchenginesimple.c	2015-12-28 16:42:28.000000000 +0100
+++ gtk+-2.24.31b/gtk/gtksearchenginesimple.c	2017-09-16 23:32:03.443419100 +0200
@@ -39,6 +39,8 @@
 
 #include <string.h>
 
+#include <glib/gstdio.h>
+
 #define BATCH_SIZE 500
 
 typedef struct 
@@ -195,10 +197,10 @@
 
 #ifdef HAVE_FTW_H
 static int
-search_visit_func (const char        *fpath,
-		   const struct stat *sb,
-		   int                typeflag,
-		   struct FTW        *ftwbuf)
+search_visit_func (const char     *fpath,
+		   const GStatBuf *sb,
+		   int             typeflag,
+		   struct FTW     *ftwbuf)
 {
   SearchThreadData *data;
   gint i;
diff -ru gtk+-2.24.31a/gtk/tests/pixbuf-init.c gtk+-2.24.31b/gtk/tests/pixbuf-init.c
--- gtk+-2.24.31a/gtk/tests/pixbuf-init.c	2015-12-28 16:42:28.000000000 +0100
+++ gtk+-2.24.31b/gtk/tests/pixbuf-init.c	2017-09-16 22:41:33.706289500 +0200
@@ -1,15 +1,13 @@
 #include "config.h"
 #include <glib.h>
-
-#include <sys/stat.h>
-#include <stdlib.h>
+#include <glib/gstdio.h>
 
 static gboolean
 file_exists (const char *filename)
 {
-  struct stat statbuf;
+  GStatBuf statbuf;
 
-  return stat (filename, &statbuf) == 0;
+  return g_stat (filename, &statbuf) == 0;
 }
 
 void
diff -ru gtk+-2.24.31a/gtk/updateiconcache.c gtk+-2.24.31b/gtk/updateiconcache.c
--- gtk+-2.24.31a/gtk/updateiconcache.c	2016-03-05 16:59:55.000000000 +0100
+++ gtk+-2.24.31b/gtk/updateiconcache.c	2017-09-16 23:31:03.675152000 +0200
@@ -74,12 +74,12 @@
 
 #include <ftw.h>
 
-static struct stat cache_stat;
+static GStatBuf cache_stat;
 static gboolean cache_up_to_date;
 
-static int check_dir_mtime (const char        *dir, 
-                            const struct stat *sb,
-                            int                tf)
+static int check_dir_mtime (const char     *dir, 
+                            const GStatBuf *sb,
+                            int             tf)
 {
   if (tf != FTW_NS && sb->st_mtime > cache_stat.st_mtime)
     {
@@ -119,7 +119,7 @@
 gboolean
 is_cache_up_to_date (const gchar *path)
 {
-  struct stat path_stat, cache_stat;
+  GStatBuf path_stat, cache_stat;
   gchar *cache_path;
   int retval; 
   
@@ -1478,7 +1478,7 @@
 #endif
   GHashTable *files;
   FILE *cache;
-  struct stat path_stat, cache_stat;
+  GStatBuf path_stat, cache_stat;
   struct utimbuf utime_buf;
   GList *directories = NULL;
   int fd;
diff -ru gtk+-2.24.31a/modules/printbackends/cups/gtkcupsutils.c gtk+-2.24.31b/modules/printbackends/cups/gtkcupsutils.c
--- gtk+-2.24.31a/modules/printbackends/cups/gtkcupsutils.c	2016-01-19 20:03:55.000000000 +0100
+++ gtk+-2.24.31b/modules/printbackends/cups/gtkcupsutils.c	2017-09-16 21:36:39.964549900 +0200
@@ -716,7 +716,7 @@
 _post_send (GtkCupsRequest *request)
 {
   gchar length[255];
-  struct stat data_info;
+  GStatBuf data_info;
 
   GTK_NOTE (PRINTING,
             g_print ("CUPS Backend: %s\n", G_STRFUNC));
diff -ru gtk+-2.24.31a/tests/testfilechooser.c gtk+-2.24.31b/tests/testfilechooser.c
--- gtk+-2.24.31a/tests/testfilechooser.c	2015-12-28 16:42:29.000000000 +0100
+++ gtk+-2.24.31b/tests/testfilechooser.c	2017-09-16 23:02:35.120039800 +0200
@@ -21,13 +21,13 @@
 
 #include <string.h>
 #include <sys/types.h>
-#include <sys/stat.h>
 #include <stdlib.h>
 #include <time.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 #include <gtk/gtk.h>
+#include <glib/gstdio.h>
 
 #ifdef G_OS_WIN32
 #  include <io.h>
@@ -189,7 +189,7 @@
 	GdkPixbufLoader *loader;
 	GdkPixbuf       *pixbuf;
 	int              info[2];
-	struct stat st;
+	GStatBuf st;
 
 	guchar buffer [4096];
 	int length;
@@ -198,7 +198,7 @@
 	g_return_val_if_fail (filename != NULL, NULL);
         g_return_val_if_fail (width > 0 && height > 0, NULL);
 
-	if (stat (filename, &st) != 0) {
+	if (g_stat (filename, &st) != 0) {
                 int errsv = errno;
 
 		g_set_error (error,
@@ -298,8 +298,8 @@
 	}
       else
 	{
-	  struct stat buf;
-	  if (stat (filename, &buf) == 0)
+	  GStatBuf buf;
+	  if (g_stat (filename, &buf) == 0)
 	    {
 	      gchar *preview_text;
 	      gchar *size_str;
diff -ru gtk+-2.24.31a/tests/testgtk.c gtk+-2.24.31b/tests/testgtk.c
--- gtk+-2.24.31a/tests/testgtk.c	2016-01-24 21:58:21.000000000 +0100
+++ gtk+-2.24.31b/tests/testgtk.c	2017-09-16 23:03:09.398073600 +0200
@@ -35,7 +35,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/stat.h>
 #include <math.h>
 #include <time.h>
 #ifdef HAVE_UNISTD_H
@@ -46,6 +45,7 @@
 #include "gtk/gtk.h"
 #include "gdk/gdk.h"
 #include "gdk/gdkkeysyms.h"
+#include "glib/gstdio.h"
 
 #ifdef G_OS_WIN32
 #define sleep(n) _sleep(n)
@@ -59,9 +59,9 @@
 gboolean
 file_exists (const char *filename)
 {
-  struct stat statbuf;
+  GStatBuf statbuf;
 
-  return stat (filename, &statbuf) == 0;
+  return g_stat (filename, &statbuf) == 0;
 }
 
 GtkWidget *
diff -ru gtk+-2.24.31a/tests/testtext.c gtk+-2.24.31b/tests/testtext.c
--- gtk+-2.24.31a/tests/testtext.c	2015-12-28 16:42:29.000000000 +0100
+++ gtk+-2.24.31b/tests/testtext.c	2017-09-16 23:03:30.787341900 +0200
@@ -20,7 +20,6 @@
 
 #include "config.h"
 #include <stdio.h>
-#include <sys/stat.h>
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
@@ -30,6 +29,7 @@
 
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
+#include <glib/gstdio.h>
 
 #include "prop-editor.h"
 
@@ -2096,9 +2096,9 @@
 
   if (!buffer->filename || strcmp (filename, buffer->filename) != 0)
     {
-      struct stat statbuf;
+      GStatBuf statbuf;
 
-      if (stat (filename, &statbuf) == 0)
+      if (g_stat (filename, &statbuf) == 0)
 	{
 	  gchar *err = g_strdup_printf ("Ovewrite existing file '%s'?", filename);
 	  gint result = msgbox_run (NULL, err, "Yes", "No", NULL, 1);
