commit 5db3b00dd7487f26ca643fa53344882136e18e76
parent a5660d8fd5f9977dcca6e7a623862a5e800e4453
Author: Nihal Jere <nihal@nihaljere.xyz>
Date: Thu, 24 Feb 2022 12:55:52 -0600
waycopy: unlink temp file immediately after creation
This way we don't have to worry about cleanup, but can still access its
contents
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/waycopy.c b/waycopy.c
@@ -64,6 +64,8 @@ main(int argc, char *argv[])
if (temp == -1)
die("failed to create temporary file for copy buffer");
+ if (unlink(path) == -1)
+ die("failed to remove temporary file");
copyfd(temp, STDIN_FILENO);
close(STDIN_FILENO);
@@ -100,6 +102,5 @@ main(int argc, char *argv[])
while (wl_display_dispatch(display) != -1 && running);
- unlink(path);
return running;
}