[epiphany] e-file-helpers: prevent invalid enumerator and return value



commit 505895520025a9b7f266b50c96a745865f10a9a7
Author: Diego Escalante Urrelo <diegoe igalia com>
Date:   Mon Apr 2 01:15:30 2012 -0500

    e-file-helpers: prevent invalid enumerator and return value
    
    Invalid enumerators can be returned even when no GError is set.
    
    Check if the enumerator is non-NULL before proceeding, and adjust the
    default return value so it is not TRUE when g_file_enumerate_children
    fails.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=673337

 lib/ephy-file-helpers.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c
index 34b2d33..3f7b7d0 100644
--- a/lib/ephy-file-helpers.c
+++ b/lib/ephy-file-helpers.c
@@ -858,12 +858,12 @@ ephy_file_delete_dir_recursively (GFile *directory, GError **error)
 {
 	GFileEnumerator *children = NULL;
 	GFileInfo *info;
-	gboolean ret = TRUE;
+	gboolean ret = FALSE;
 
 	children = g_file_enumerate_children (directory,
 					      "standard::name,standard::type",
 					      0, NULL, error);
-	if (error)
+	if (children == NULL || error)
 		goto out;
 
 	info = g_file_enumerator_next_file (children, NULL, error);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]