[glib] Adapt to recent MLS changes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Adapt to recent MLS changes
- Date: Fri, 9 Jul 2010 11:26:43 +0000 (UTC)
commit c24a29e13bcf2c36140c5d8467a9258402c347aa
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jul 9 07:24:08 2010 -0400
Adapt to recent MLS changes
g_file_query_info returns non-NULL more often now.
gio/gfile.c | 7 ++++---
gio/tests/live-g-file.c | 5 +----
2 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/gio/gfile.c b/gio/gfile.c
index b693326..9fd10ca 100644
--- a/gio/gfile.c
+++ b/gio/gfile.c
@@ -2455,7 +2455,8 @@ open_source_for_copy (GFile *source,
info = g_file_query_info (destination, G_FILE_ATTRIBUTE_STANDARD_TYPE,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
cancellable, &my_error);
- if (info != NULL)
+ if (info != NULL &&
+ g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_TYPE))
{
file_type = g_file_info_get_file_type (info);
g_object_unref (info);
@@ -2482,12 +2483,12 @@ open_source_for_copy (GFile *source,
/* Error getting info from target, return that error
* (except for NOT_FOUND, which is no error here)
*/
- if (my_error->domain != G_IO_ERROR && my_error->code != G_IO_ERROR_NOT_FOUND)
+ if (my_error != NULL && !g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
{
g_propagate_error (error, my_error);
return NULL;
}
- g_error_free (my_error);
+ g_clear_error (&my_error);
}
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_WOULD_RECURSE,
diff --git a/gio/tests/live-g-file.c b/gio/tests/live-g-file.c
index 75ff5de..32203b6 100644
--- a/gio/tests/live-g-file.c
+++ b/gio/tests/live-g-file.c
@@ -702,10 +702,7 @@ do_copy_move (GFile * root, struct StructureItem item, const char *target_dir,
(extra_flags == TEST_TARGET_IS_FILE))
{
g_assert_cmpint (res, ==, FALSE);
- if (item.file_type == G_FILE_TYPE_DIRECTORY)
- g_assert_error (error, G_IO_ERROR, G_IO_ERROR_WOULD_RECURSE);
- else
- g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_DIRECTORY);
+ g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_DIRECTORY);
}
/* source file is directory */
else if ((item.extra_flags & TEST_COPY_ERROR_RECURSE) ==
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]