{
#ifdef HAVE_SYS_MMAN_H
Evas_Object_Image *o;
- char buf[4096];
+ char buf[PATH_MAX];
void *dst;
int fd = -1;
#endif
if (fd < 0)
{
- snprintf(buf, sizeof(buf), "/tmp/.evas-tmpf-%i-%p-%i-XXXXXX",
- (int)getpid(), data, (int)size);
+ const char *tmpdir = getenv("TMPDIR");
+
+ if (!tmpdir)
+ {
+ tmpdir = getenv("TMP");
+ if (!tmpdir)
+ {
+ tmpdir = getenv("TEMP");
+ if (!tmpdir) tmpdir = "/tmp";
+ }
+ }
+ snprintf(buf, sizeof(buf), "%s/.evas-tmpf-%i-%p-%i-XXXXXX",
+ tmpdir, (int)getpid(), data, (int)size);
fd = mkstemp(buf);
+ if (fd < 0) return;
}
- if (fd < 0) return;
if (ftruncate(fd, size) < 0)
{
unlink(buf);
close(fd);
return;
}
+#ifdef __linux__
unlink(buf);
+#endif
eina_mmap_safety_enabled_set(EINA_TRUE);