Skip to content

Conversation

@arwarw
Copy link

@arwarw arwarw commented Jun 29, 2025

This makes use of a temporary directory that is securely (as far as possible) created and cleaned up.

arwarw added 2 commits June 29, 2025 18:09
Add an option -i to replace the input file with the shrunk output (if
smaller). This creates a temporary directory in a secure and portable
manner, cleaning it up afterwards.

The temporary directory is created using 'mktemp' if present, otherwise
the less secure method of including the PID, current time and possibly
(if available) $RANDOM is used. The directory is removed upon exit, but
carefully: 'rm -fr' is only executed on a then-empty directory after
output.pdf has been removed. This could leak directories, but I consider
that less of a problem than possibly removing something important.
@arwarw arwarw mentioned this pull request Jun 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant