After talking about the previous version of the patch with raster on
IRC, I'm sending a more conservative version that does not change the
Linux behavior -- /dev/shm is expected to work on Linux, and the
non-Linux case works at the expense of leaving some files in /tmp if a
crash occurs before _cleanup_tmpf() is called.

Index: src/lib/canvas/evas_object_image.c
===================================================================
--- src/lib/canvas/evas_object_image.c	(revision 71134)
+++ src/lib/canvas/evas_object_image.c	(working copy)
@@ -203,8 +203,7 @@
 
    o = (Evas_Object_Image *)(obj->object_data);
    if (!o->tmpf) return;
-#ifdef __linux__
-#else
+#ifndef __linux__
    unlink(o->tmpf);
 #endif
    if (o->tmpf_fd >= 0) close(o->tmpf_fd);
@@ -229,14 +228,11 @@
 #ifdef __linux__
    snprintf(buf, sizeof(buf), "/dev/shm/.evas-tmpf-%i-%p-%i-XXXXXX", 
             (int)getpid(), data, (int)size);
+#else
+   snprintf(buf, sizeof(buf), "/tmp/.evas-tmpf-%i-%p-%i-XXXXXX", 
+	    (int)getpid(), data, (int)size);
+#endif
    fd = mkstemp(buf);
-#endif   
-   if (fd < 0)
-     {
-        snprintf(buf, sizeof(buf), "/tmp/.evas-tmpf-%i-%p-%i-XXXXXX", 
-                 (int)getpid(), data, (int)size);
-        fd = mkstemp(buf);
-     }
    if (fd < 0) return;
    if (ftruncate(fd, size) < 0)
      {
@@ -244,7 +240,9 @@
         close(fd);
         return;
      }
+#ifdef __linux__
    unlink(buf);
+#endif
    
    eina_mmap_safety_enabled_set(EINA_TRUE);
    
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to