Skip to content

Commit

Permalink
screenshot: remove variable-length-array
Browse files Browse the repository at this point in the history
It will interfere with goto-based cleanup logic.
  • Loading branch information
t-8ch authored and emersion committed May 18, 2024
1 parent fa0961b commit 32b009a
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/screenshot/screenshot.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,14 @@ static int method_screenshot(sd_bus_message *msg, void *data,

// TODO: choose a better path
const char path[] = "/tmp/out.png";
const char uri[] = "file:///tmp/out.png";
if (interactive && !exec_screenshooter_interactive(path)) {
return -1;
}
if (!interactive && !exec_screenshooter(path)) {
return -1;
}

const char uri_prefix[] = "file://";
char uri[strlen(path) + strlen(uri_prefix) + 1];
snprintf(uri, sizeof(uri), "%s%s", uri_prefix, path);

sd_bus_message *reply = NULL;
ret = sd_bus_message_new_method_return(msg, &reply);
if (ret < 0) {
Expand Down

0 comments on commit 32b009a

Please sign in to comment.