[libgsf] SELINUX: write temp files in tmp directory.



commit 3d2524ec34572b33115f67a4a82930f7a4f79de9
Author: Morten Welinder <terra gnome org>
Date:   Tue Apr 23 21:34:56 2013 -0400

    SELINUX: write temp files in tmp directory.

 thumbnailer/main.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/thumbnailer/main.c b/thumbnailer/main.c
index d3ea66f..df59d7b 100644
--- a/thumbnailer/main.c
+++ b/thumbnailer/main.c
@@ -97,14 +97,19 @@ call_convert (const char *in_filename, const char *out_filename, int thumb_size)
 static void
 write_thumbnail (const char *filename, gconstpointer data, gsize size, int thumb_size)
 {
+       GError *error = NULL;
        char *tmp_name;
        int fd;
        FILE *file;
 
-       tmp_name = g_strdup_printf ("%s.XXXXXX", filename);
-       fd = g_mkstemp (tmp_name);
-       if (fd == -1) {
-               perror ("Could not create temporary file");
+       fd = g_file_open_tmp("gsf-thumbnailer-XXXXXX", &tmp_name, &error);
+       if (error) {
+               if (error->message) {
+                       g_printerr ("error: %s\n", error->message);
+               } else {
+                       g_printerr ("error: %s\n", "Could not create tmp file");
+               }
+               g_error_free (error);
                exit (EXIT_FAILURE);
        }
 


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