diff options
Diffstat (limited to 'gdk-pixbuf/io-tiff.c')
-rw-r--r-- | gdk-pixbuf/io-tiff.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/gdk-pixbuf/io-tiff.c b/gdk-pixbuf/io-tiff.c index 602adb8468..3dd397fda2 100644 --- a/gdk-pixbuf/io-tiff.c +++ b/gdk-pixbuf/io-tiff.c @@ -33,6 +33,10 @@ #include "gdk-pixbuf-private.h" #include "gdk-pixbuf-io.h" +#ifdef G_OS_WIN32 +#include <fcntl.h> +#define O_RDWR _O_RDWR +#endif typedef struct _TiffData TiffData; @@ -146,14 +150,24 @@ gdk_pixbuf__tiff_image_begin_load (ModulePreparedNotifyFunc prepare_func, { TiffData *context; gint fd; + gchar *tmp = g_get_tmp_dir (); context = g_new (TiffData, 1); context->prepare_func = prepare_func; context->update_func = update_func; context->user_data = user_data; context->all_okay = TRUE; - context->tempname = g_strdup ("/tmp/gdkpixbuf-tif-tmp.XXXXXX"); + context->tempname = + g_strconcat (tmp, + tmp[strlen (tmp)] == G_DIR_SEPARATOR ? G_DIR_SEPARATOR_S : "", + "gdkpixbuf-tif-tmp.XXXXXX", + NULL); +#ifdef HAVE_MKSTEMP fd = mkstemp (context->tempname); +#else + mktemp (context->tempname); + fd = open (context->tempname, O_RDWR); +#endif if (fd < 0) { g_free (context); return NULL; @@ -182,6 +196,7 @@ gdk_pixbuf__tiff_image_stop_load (gpointer data) fclose (context->file); unlink (context->tempname); + g_free (context->tempname); g_free ((TiffData *) context); } |