From 8ab0073b49cbac51032c6a6ef0b2b38ca7f3b814 Mon Sep 17 00:00:00 2001 From: Markus Ongyerth Date: Sat, 24 Feb 2018 23:55:48 +0100 Subject: 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. --- examples/screenshot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples') 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); -- cgit v1.2.3