aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Ongyerth <ongy@ongy.net>2018-02-24 23:55:48 +0100
committerMarkus Ongyerth <ongy@ongy.net>2018-02-24 23:55:48 +0100
commit8ab0073b49cbac51032c6a6ef0b2b38ca7f3b814 (patch)
tree068a72017921ca1dd27f9f09f01abf6268199f59
parent69409ea3cb3bfba52df9ff35a9b58f6f1b3dc25e (diff)
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.
-rw-r--r--examples/screenshot.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/screenshot.c b/examples/screenshot.c
index 7edb7327..e73989c6 100644
--- a/examples/screenshot.c
+++ b/examples/screenshot.c
@@ -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);