From: Thadeu Lima de Souza Cascardo Date: Sun, 31 Aug 2008 04:54:51 +0000 (-0300) Subject: If GIO cannot enumerate directory, set error and return X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fatompub.git;a=commitdiff_plain;h=e53b0fc7c7e264a421fcd8ff82d2b51a50e4483c If GIO cannot enumerate directory, set error and return --- diff --git a/backend/gio/gio.c b/backend/gio/gio.c index f430f84..a0cb790 100644 --- a/backend/gio/gio.c +++ b/backend/gio/gio.c @@ -73,14 +73,23 @@ gio_enumerate_entries (AtomCtx *ctx, AtomEntry ***entries, size_t *len) GFileEnumerator *enumerator; GFileInfo *info; GFile *file; + GError *error; gchar *root; gchar *name; gchar *filename; GPtrArray *array; root = atom_config_get_str (ctx, "gio", "root"); dir = g_file_new_for_path (root); + error = NULL; enumerator = g_file_enumerate_children (dir, G_FILE_ATTRIBUTE_STANDARD_NAME, - G_FILE_QUERY_INFO_NONE, NULL, NULL); + G_FILE_QUERY_INFO_NONE, NULL, &error); + if (enumerator == NULL) + { + AtomError *aerr = atom_error_new_from_gerror (error); + atom_error_set (ctx, aerr); + g_error_free (error); + return; + } array = g_ptr_array_new (); while ((info = g_file_enumerator_next_file (enumerator, NULL, NULL)) != NULL) {