prevent screenshot from resuing template array

The template array given to mkstemp was declared static. This reused the
memory, which caused mkstemp to fail if backingfile is run more than
once, because the array no longer contained the template syntax
(which is forced to end in XXXXXX) but the previous file name.
This commit is contained in:
Markus Ongyerth 2018-02-24 23:55:48 +01:00
parent 69409ea3cb
commit 8ab0073b49

View File

@ -122,7 +122,7 @@ static const struct wl_registry_listener registry_listener = {
};
static int backingfile(off_t size) {
static char template[] = "/tmp/wlroots-shared-XXXXXX";
char template[] = "/tmp/wlroots-shared-XXXXXX";
int fd, ret;
fd = mkstemp(template);