[file-roller: 46/123] fixed potential error when renaming a file
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller: 46/123] fixed potential error when renaming a file
- Date: Mon, 6 Aug 2012 13:44:44 +0000 (UTC)
commit 4cbe4b85b1228403ba898e0332473c8c93cbab50
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sat Jul 21 09:43:37 2012 +0200
fixed potential error when renaming a file
reset the filename after calling _fr_command_remove.
src/Makefile.am | 2 +-
src/fr-command.c | 8 ++++++--
2 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 09b108e..d5ca098 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -184,7 +184,7 @@ fr-enum-types.h: typedefs.h $(GLIB_MKENUMS)
fr-enum-types.c: typedefs.h fr-enum-types.h
$(AM_V_GEN)( $(GLIB_MKENUMS) \
- --fhead "#include <glib-object.h>\n" \
+ --fhead "#include <glib-object.h>\n#include \"fr-enum-types.h\"\n" \
--fprod "\n/* enumerations from \"@filename \" */\n#include \"@filename \"" \
--vhead "GType\n enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G Type@Value values[] = {" \
--vprod " { @VALUENAME@, \"@VALUENAME \", \"@valuenick \" }," \
diff --git a/src/fr-command.c b/src/fr-command.c
index aa1976d..fcbda5d 100644
--- a/src/fr-command.c
+++ b/src/fr-command.c
@@ -1820,7 +1820,7 @@ _fr_command_remove (FrCommand *self,
delete_from_archive (self, file_list);
fr_command_recompress (self);
- /* move the new self to the original position */
+ /* move the new archive to the original position */
fr_process_begin_command (self->process, "mv");
fr_process_add_arg (self->process, "-f");
@@ -1837,6 +1837,11 @@ _fr_command_remove (FrCommand *self,
fr_process_add_arg (self->process, tmp_archive_dir);
fr_process_end_command (self->process);
+ /* _fr_command_remove can change the filename, reset its value */
+ g_object_set (archive,
+ "filename", self->priv->local_copy,
+ NULL);
+
g_free (tmp_archive_filename);
g_free (archive_filename);
g_free (tmp_archive_dir);
@@ -2706,7 +2711,6 @@ fr_command_rename (FrArchive *archive,
added_dir = TRUE;
}
- /* FIXME: libarchive, check this */
_fr_command_remove (self, file_list, archive->compression);
/* ...and remove it from the list again */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]