diff options
author | Carsten Haitzler <raster@rasterman.com> | 2012-12-10 07:13:55 +0000 |
---|---|---|
committer | Carsten Haitzler <raster@rasterman.com> | 2012-12-10 07:13:55 +0000 |
commit | b3b09ae9e0ad070ce9117969a80c7eab0280cc39 (patch) | |
tree | dbf82646f717d7bfde4054146b483870fb6bf966 /src/modules/shot/e_mod_main.c | |
parent | 463617699c21228bba986f24be42bc4e8702b120 (diff) | |
download | enlightenment-b3b09ae9e0ad070ce9117969a80c7eab0280cc39.tar.gz enlightenment-b3b09ae9e0ad070ce9117969a80c7eab0280cc39.tar.xz enlightenment-b3b09ae9e0ad070ce9117969a80c7eab0280cc39.zip |
actually us fdopen and hex, and random numbers for tmp shot file.
SVN revision: 80571
Diffstat (limited to 'src/modules/shot/e_mod_main.c')
-rw-r--r-- | src/modules/shot/e_mod_main.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/modules/shot/e_mod_main.c b/src/modules/shot/e_mod_main.c index d83cba1bd..126b3151a 100644 --- a/src/modules/shot/e_mod_main.c +++ b/src/modules/shot/e_mod_main.c @@ -431,10 +431,21 @@ _win_share_cb(void *data __UNUSED__, void *data2 __UNUSED__) Evas_Coord mw, mh; char buf[PATH_MAX]; FILE *f; + int i, fd = -1; - if (quality == 100) snprintf(buf, sizeof(buf), "/tmp/e-shot-XXXXXX.png"); - else snprintf(buf, sizeof(buf), "/tmp/e-shot-XXXXXX.jpg"); - if (!mkstemps(buf, 4)) + srand(time(NULL)); + for (i = 0; i < 10240; i++) + { + int v = rand(); + + if (quality == 100) + snprintf(buf, sizeof(buf), "/tmp/e-shot-%x.png", v); + else + snprintf(buf, sizeof(buf), "/tmp/e-shot-%x.jpg", v); + fd = open(buf, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); + if (fd >= 0) break; + } + if (fd < 0) { e_util_dialog_show(_("Error - Can't create file"), _("Cannot create temporary file '%s': %s"), @@ -452,7 +463,7 @@ _win_share_cb(void *data __UNUSED__, void *data2 __UNUSED__) e_object_del(E_OBJECT(win)); win = NULL; } - f = fopen(buf, "rb"); + f = fdopen(fd, "rb"); if (!f) { e_util_dialog_show(_("Error - Can't open file"), |