[gnome-autoar/wip/oholy/various-fixes: 5/23] extractor: Prevent creation of unrelated directories
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-autoar/wip/oholy/various-fixes: 5/23] extractor: Prevent creation of unrelated directories
- Date: Fri, 12 Mar 2021 15:42:20 +0000 (UTC)
commit b5c8efcd87afa8e40d87c8e54ba446298da9136d
Author: Ondrej Holy <oholy redhat com>
Date: Fri Feb 19 09:30:42 2021 +0100
extractor: Prevent creation of unrelated directories
`g_file_make_directory_with_parents` is called to create `self->destination_dir`
directory before extraction. However, the files may be written to completely
different dir later if the they have common prefix and the prefix is consequently
changed over `decide-destination` signal. Let's use `self->prefix_new` if it is
set to prevent creation of unrelated directories.
gnome-autoar/autoar-extractor.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/gnome-autoar/autoar-extractor.c b/gnome-autoar/autoar-extractor.c
index c851972..eda7a85 100644
--- a/gnome-autoar/autoar-extractor.c
+++ b/gnome-autoar/autoar-extractor.c
@@ -1854,19 +1854,18 @@ autoar_extractor_step_decide_destination (AutoarExtractor *self)
}
}
- destination_name = g_file_get_path (self->new_prefix != NULL ?
- self->new_prefix :
- self->destination_dir);
+ new_destination = (self->new_prefix != NULL) ? self->new_prefix : self->destination_dir;
+ destination_name = g_file_get_path (new_destination);
g_debug ("autoar_extractor_step_decide_destination: destination %s", destination_name);
- g_file_make_directory_with_parents (self->destination_dir,
+ g_file_make_directory_with_parents (new_destination,
self->cancellable,
&(self->error));
if (g_error_matches (self->error, G_IO_ERROR, G_IO_ERROR_EXISTS)) {
GFileType file_type;
- file_type = g_file_query_file_type (self->destination_dir,
+ file_type = g_file_query_file_type (new_destination,
G_FILE_QUERY_INFO_NONE,
NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]