summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzhuyaliang <[email protected]>2023-05-11 16:02:49 +0800
committerraveit65 <[email protected]>2023-05-13 19:22:34 +0200
commit2750084388d9cb6164a99be13070f5d8b56e866b (patch)
tree1dbf60e9102d99c9d7df17eb8438538aa9656a3e /src
parent9cbea8d2e8f14ea4477c21d8fdf14d58ec00f6a9 (diff)
downloadengrampa-2750084388d9cb6164a99be13070f5d8b56e866b.tar.bz2
engrampa-2750084388d9cb6164a99be13070f5d8b56e866b.tar.xz
Archive do not track symbolic link
g_file_enumerate_children_async default should use G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS. This can avoid link loops
Diffstat (limited to 'src')
-rw-r--r--src/gio-utils.c22
-rw-r--r--src/gio-utils.h5
2 files changed, 18 insertions, 9 deletions
diff --git a/src/gio-utils.c b/src/gio-utils.c
index 5f66e1f..2fd8b47 100644
--- a/src/gio-utils.c
+++ b/src/gio-utils.c
@@ -300,7 +300,7 @@ for_each_child_next_files_ready (GObject *source_object,
}
}
- fec->for_each_file_func (uri, child_info, fec->user_data);
+ fec->for_each_file_func (uri, fec->follow_links, child_info, fec->user_data);
g_free (uri);
g_object_unref (f);
@@ -360,9 +360,9 @@ for_each_child_start_current (ForEachChildData *fec)
g_file_enumerate_children_async (fec->current,
"standard::name,standard::type",
- fec->follow_links ? G_FILE_QUERY_INFO_NONE : G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
G_PRIORITY_DEFAULT,
- fec->cancellable,
+ fec->cancellable,
for_each_child_ready,
fec);
}
@@ -610,8 +610,9 @@ get_file_list_done (GError *error,
static void
get_file_list_for_each_file (const char *uri,
- GFileInfo *info,
- gpointer user_data)
+ gboolean follow_links,
+ GFileInfo *info,
+ gpointer user_data)
{
GetFileListData *gfl = user_data;
@@ -621,6 +622,12 @@ get_file_list_for_each_file (const char *uri,
if ((gfl->exclude_filter->pattern == NULL) || ! filter_matches (gfl->exclude_filter, uri))
gfl->files = g_list_prepend (gfl->files, g_strdup (uri));
break;
+ case G_FILE_TYPE_SYMBOLIC_LINK:
+ if (follow_links)
+ if (filter_matches (gfl->include_filter, uri))
+ if ((gfl->exclude_filter->pattern == NULL) || ! filter_matches (gfl->exclude_filter, uri))
+ gfl->files = g_list_prepend (gfl->files, g_strdup (uri));
+ break;
default:
break;
}
@@ -1283,8 +1290,9 @@ g_directory_copy_list_ready (GError *error,
static void
g_directory_copy_for_each_file (const char *uri,
- GFileInfo *info,
- gpointer user_data)
+ gboolean follow_links,
+ GFileInfo *info,
+ gpointer user_data)
{
DirectoryCopyData *dcd = user_data;
diff --git a/src/gio-utils.h b/src/gio-utils.h
index 47add16..e8d99aa 100644
--- a/src/gio-utils.h
+++ b/src/gio-utils.h
@@ -38,8 +38,9 @@ typedef DirOp (*StartDirCallback) (const char *uri,
GError **error,
gpointer user_data);
typedef void (*ForEachChildCallback) (const char *uri,
- GFileInfo *info,
- gpointer user_data);
+ gboolean follow_links,
+ GFileInfo *info,
+ gpointer user_data);
typedef void (*ForEachDoneCallback) (GError *error,
gpointer data);
typedef void (*ListReadyCallback) (GList *files,