wl_screenshot: Fix eina_file_mkstemp usage.

In my previous commit I did not took into account that ein_file_mkstemp
does not alter the given filename. This is different from mkstemp and I
missed that.

We now ask for the new filename and use it instead.
This commit is contained in:
Stefan Schmidt 2013-11-21 09:25:56 +01:00
parent 46ee3c3226
commit ab82c45a5d
1 changed files with 5 additions and 3 deletions

View File

@ -219,15 +219,16 @@ static struct wl_buffer *
_create_shm_buffer(struct wl_shm *_shm, int width, int height, void **data_out)
char filename[] = "wayland-shm-XXXXXX";
Eina_Tmpstr *tmpfile = NULL;
struct wl_shm_pool *pool;
struct wl_buffer *buffer;
int fd, size, stride;
void *data;
fd = eina_file_mkstemp(filename, NULL);
fd = eina_file_mkstemp(filename, &tmpfile);
if (fd < 0)
fprintf(stderr, "open %s failed: %m\n", filename);
fprintf(stderr, "open %s failed: %m\n", tmpfile);
return NULL;
@ -241,7 +242,8 @@ _create_shm_buffer(struct wl_shm *_shm, int width, int height, void **data_out)
data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (data == MAP_FAILED)