Skip to main content

Module scratch

Module scratch 

Source
Expand description

Private temporary files: a part for a mailcap %s command, a signature for gpg, a draft for the editor. They live in the shared temp dir, so each is created fresh (O_EXCL: never through a link or over a file someone else put there) and readable by us alone.

Functions§

save_private
Replace path with bytes whole, readable by us alone: written beside it (mode 0600, synced) and renamed over it, so a crash leaves the old file or the new one. For what rmut keeps of the user’s own, such as the prompt history.
write
bytes in a new file rmut-<what>-<unique><suffix> under the temp dir, mode 0600. The caller removes it.