[Xfce4-commits] r25631 - in squeeze/branches/squeeze_0_2: . libsqueeze
Stephan Arts
stephan at xfce.org
Tue Apr 24 12:38:25 CEST 2007
Author: stephan
Date: 2007-04-24 10:38:25 +0000 (Tue, 24 Apr 2007)
New Revision: 25631
Modified:
squeeze/branches/squeeze_0_2/NEWS
squeeze/branches/squeeze_0_2/libsqueeze/archive.h
squeeze/branches/squeeze_0_2/libsqueeze/command-builder-gnu-tar.c
squeeze/branches/squeeze_0_2/libsqueeze/internals.h
squeeze/branches/squeeze_0_2/libsqueeze/spawn-command.c
Log:
fixed /tmp cleanup
Modified: squeeze/branches/squeeze_0_2/NEWS
===================================================================
--- squeeze/branches/squeeze_0_2/NEWS 2007-04-22 21:52:33 UTC (rev 25630)
+++ squeeze/branches/squeeze_0_2/NEWS 2007-04-24 10:38:25 UTC (rev 25631)
@@ -5,6 +5,8 @@
line arguments
- Fixed stopping the execution of macro-commands (used for compressed
tarballs)
+- When creating a compressed-tar archive is cancelled, cleanup the file
+ in the /tmp directory
0.2.0
=====
Modified: squeeze/branches/squeeze_0_2/libsqueeze/archive.h
===================================================================
--- squeeze/branches/squeeze_0_2/libsqueeze/archive.h 2007-04-22 21:52:33 UTC (rev 25630)
+++ squeeze/branches/squeeze_0_2/libsqueeze/archive.h 2007-04-24 10:38:25 UTC (rev 25631)
@@ -44,6 +44,7 @@
LSQArchive *lsq_archive_new(gchar *, const gchar *) G_GNUC_INTERNAL;
void lsq_archive_state_changed(const LSQArchive *archive) G_GNUC_INTERNAL;
+
G_END_DECLS
#endif /* __ARCHIVE_H__ */
Modified: squeeze/branches/squeeze_0_2/libsqueeze/command-builder-gnu-tar.c
===================================================================
--- squeeze/branches/squeeze_0_2/libsqueeze/command-builder-gnu-tar.c 2007-04-22 21:52:33 UTC (rev 25630)
+++ squeeze/branches/squeeze_0_2/libsqueeze/command-builder-gnu-tar.c 2007-04-24 10:38:25 UTC (rev 25631)
@@ -35,7 +35,6 @@
#define SQ_BSD
#endif
-#define LSQ_ARCHIVE_TEMP_FILE "gnu_tar_temp_file"
static void
lsq_command_builder_gnu_tar_class_init(LSQCommandBuilderGnuTarClass *);
@@ -238,7 +237,8 @@
compress_skeleton,
NULL,
NULL,
- tmp_file);
+ NULL);
+ g_object_set_data(G_OBJECT(compress), LSQ_ARCHIVE_TEMP_FILE, tmp_file);
if(!lsq_spawn_command_set_parse_func(LSQ_SPAWN_COMMAND(compress), 1, lsq_command_builder_gnu_tar_compress_parse_output, NULL))
{
@@ -286,6 +286,8 @@
files,
options,
tmp_file);
+ if(tmp_file)
+ g_object_set_data(G_OBJECT(spawn), LSQ_ARCHIVE_TEMP_FILE, tmp_file);
add_macro = lsq_macro_command_new(archive);
if(decompress)
{
@@ -340,7 +342,8 @@
#endif
files,
options,
- tmp_file);
+ NULL);
+ g_object_set_data(G_OBJECT(spawn), LSQ_ARCHIVE_TEMP_FILE, tmp_file);
if(decompress_skeleton)
{
@@ -359,6 +362,8 @@
NULL,
NULL,
tmp_file);
+ g_object_set_data(G_OBJECT(compress), LSQ_ARCHIVE_TEMP_FILE, tmp_file);
+
remove_macro = lsq_macro_command_new(archive);
lsq_macro_command_append(LSQ_MACRO_COMMAND(remove_macro), decompress);
g_object_unref(decompress);
Modified: squeeze/branches/squeeze_0_2/libsqueeze/internals.h
===================================================================
--- squeeze/branches/squeeze_0_2/libsqueeze/internals.h 2007-04-22 21:52:33 UTC (rev 25630)
+++ squeeze/branches/squeeze_0_2/libsqueeze/internals.h 2007-04-24 10:38:25 UTC (rev 25631)
@@ -33,3 +33,5 @@
LSQArchive *
lsq_opened_archive_get_archive(gchar *path);
+
+#define LSQ_ARCHIVE_TEMP_FILE "archive_temp_file"
Modified: squeeze/branches/squeeze_0_2/libsqueeze/spawn-command.c
===================================================================
--- squeeze/branches/squeeze_0_2/libsqueeze/spawn-command.c 2007-04-22 21:52:33 UTC (rev 25630)
+++ squeeze/branches/squeeze_0_2/libsqueeze/spawn-command.c 2007-04-24 10:38:25 UTC (rev 25631)
@@ -149,7 +149,7 @@
LSQArchive *archive,
const gchar *command,
const gchar *files,
- const gchar *options,
+ const gchar *options,
const gchar *archive_path)
{
LSQArchiveCommand *archive_command;
@@ -170,6 +170,7 @@
LSQ_SPAWN_COMMAND(archive_command)->files = g_strdup(files);
LSQ_SPAWN_COMMAND(archive_command)->options = g_strdup(options);
+ archive_path = g_object_get_data(G_OBJECT(archive_command), LSQ_ARCHIVE_TEMP_FILE);
if(archive_path)
LSQ_SPAWN_COMMAND(archive_command)->archive_path = g_strdup(archive_path);
else
@@ -261,6 +262,7 @@
lsq_spawn_command_child_watch_func(GPid pid, gint status, gpointer data)
{
LSQArchiveCommand *command = LSQ_ARCHIVE_COMMAND(data);
+ gchar *tmp_file;
if(WIFEXITED(status))
{
if(WEXITSTATUS(status))
@@ -276,15 +278,27 @@
switch(WTERMSIG(status))
{
case SIGHUP:
+ tmp_file = g_object_get_data(G_OBJECT(command), LSQ_ARCHIVE_TEMP_FILE);
+ g_unlink(tmp_file);
+ g_free(tmp_file);
+ g_object_set_data(G_OBJECT(command), LSQ_ARCHIVE_TEMP_FILE, NULL);
if(!command->error)
command->error = g_error_new_literal(command->domain, status, _("Command interrupted by user"));
break;
case SIGSEGV:
+ tmp_file = g_object_get_data(G_OBJECT(command), LSQ_ARCHIVE_TEMP_FILE);
+ g_unlink(tmp_file);
+ g_free(tmp_file);
+ g_object_set_data(G_OBJECT(command), LSQ_ARCHIVE_TEMP_FILE, NULL);
if(!command->error)
command->error = g_error_new_literal(command->domain, status, _("Command received SIGSEGV"));
break;
case SIGKILL:
case SIGINT:
+ tmp_file = g_object_get_data(G_OBJECT(command), LSQ_ARCHIVE_TEMP_FILE);
+ g_unlink(tmp_file);
+ g_free(tmp_file);
+ g_object_set_data(G_OBJECT(command), LSQ_ARCHIVE_TEMP_FILE, NULL);
if(!command->error)
command->error = g_error_new_literal(command->domain, status, _("Command Terminated"));
break;
More information about the Xfce4-commits
mailing list