[file-roller/gnome-2-30] escape new lines in filenames when saving the file list to a file



commit 2194eddd71a01f178defa1137d7fab01acedf44b
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Tue Jul 6 09:31:15 2010 +0200

    escape new lines in filenames when saving the file list to a file

 src/fr-archive.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/fr-archive.c b/src/fr-archive.c
index ff71e92..83d0889 100644
--- a/src/fr-archive.c
+++ b/src/fr-archive.c
@@ -1160,12 +1160,17 @@ save_list_to_temp_file (GList   *file_list,
 		for (scan = file_list; scan != NULL; scan = scan->next) {
 			char *filename = scan->data;
 
+			filename = str_substitute (filename, "\n", "\\n");
 			if ((g_output_stream_write (G_OUTPUT_STREAM (ostream), filename, strlen (filename), NULL, error) < 0)
 			    || (g_output_stream_write (G_OUTPUT_STREAM (ostream), "\n", 1, NULL, error) < 0))
 			{
 				error_occurred = TRUE;
-				break;
 			}
+
+			g_free (filename);
+
+			if (error_occurred)
+				break;
 		}
 		if (! error_occurred && ! g_output_stream_close (G_OUTPUT_STREAM (ostream), NULL, error))
 			error_occurred = TRUE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]