[baobab/wip/new-design: 1/59] baobab-scan: workaround bugzilla bug 672219
- From: Stefano Facchini <sfacchini src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [baobab/wip/new-design: 1/59] baobab-scan: workaround bugzilla bug 672219
- Date: Sun, 1 Apr 2012 17:09:46 +0000 (UTC)
commit 69e2087b159ccd4a2a95b0e8e4f51dd914bd912b
Author: Stefano Facchini <stefano facchini gmail com>
Date: Fri Mar 16 14:24:59 2012 +0100
baobab-scan: workaround bugzilla bug 672219
After recent gio changes, on some filesystems (namely NTFS) a symlink
to a directory is reported by GFileEnumerator as a normal directory.
This can generate infinite loops if there is a symlink to .. somewhere.
Since this only affects GFileEnumerator and not g_file_query_info(),
workaround this issue using the latter.
src/baobab-scan.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/baobab-scan.c b/src/baobab-scan.c
index e9f6dbc..cba723c 100644
--- a/src/baobab-scan.c
+++ b/src/baobab-scan.c
@@ -267,8 +267,25 @@ loopdir (GFile *file,
/* is a directory? */
if (temp_type == G_FILE_TYPE_DIRECTORY) {
+ GFileInfo *dir_info;
GFile *child_dir = g_file_get_child (file,
g_file_info_get_name (temp_info));
+
+ /* Workaround bug http://bugzilla.gnome.org/show_bug.cgi?id=672219 */
+ dir_info = g_file_query_info (child_dir,
+ G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK,
+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+ NULL,
+ NULL);
+ if (dir_info != NULL &&
+ g_file_info_get_attribute_boolean (dir_info,
+ G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK)) {
+ g_object_unref (child_dir);
+ g_object_unref (dir_info);
+ g_object_unref (temp_info);
+ continue;
+ }
+
temp = loopdir (child_dir, temp_info, count, hla, current_depth+1);
retloop.size += temp.size;
retloop.alloc_size += temp.alloc_size;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]