From 14e0a65dee44af822911ba32d140c7801306252e Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Mon, 24 Aug 2015 12:04:01 +0200 Subject: Fixes for temporary file handling in WinCreateBitmap --- Linux_C_12/cpicture_121.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Linux_C_12/cpicture_121.c b/Linux_C_12/cpicture_121.c index 4b08fea..07f85f3 100644 --- a/Linux_C_12/cpicture_121.c +++ b/Linux_C_12/cpicture_121.c @@ -11,6 +11,7 @@ #include "util_121.h" #include #include +#include #include "cpicture_121.h" #include "cCrossCall_121.h" #include "cCrossCallWindows_121.h" @@ -1172,13 +1173,16 @@ void WinCreateBitmap (CLEAN_STRING data, GdkDrawable *inDraw,OS ios, printf("WinCreateBitmap\n"); - char* tempfile = "/tmp/bitmapXXXXXX"; - int tempfh = mkstemp(tempfile); + char tempfile[23]; + rscopy(tempfile, "/tmp/bitmap.XXXXXX.bmp"); + int tempfh = mkstemps(tempfile,4); + int errsv = errno; if (tempfh == -1) { - printf("Couldn't create temporary file.\n"); + printf("Couldn't create temporary file - %d\n", errsv); exit(1); } write(tempfh, cdata, CleanStringLength(data)); + free(cdata); InitGTK(); *bitmap = gdk_pixbuf_new_from_file(tempfile, &err); -- cgit v1.2.3