[pbs-devel] [PATCH pbs-client v4] fix #3699: client: prefer xdg cache directory for tmp files

Maximiliano Sandoval m.sandoval at proxmox.com
Mon Feb 12 11:37:53 CET 2024



Maximiliano Sandoval <m.sandoval at proxmox.com> writes:

> Adds a helper to create temporal files in XDG_CACHE_HOME. If we cannot
> create a file there, we fallback to /tmp as before.

I just noticed that I didn't backtick the documentation of
`create_tmp_file`:

```diff
@@ -529,8 +529,8 @@ pub fn place_xdg_file(
         .with_context(|| format!("failed to place {} in xdg home", description))
 }

-/// Creates a temporary file (with O_TMPFILE) in XDG_CACHE_HOME. If we cannot
-/// create the file there it will be created in /tmp instead.
+/// Creates a temporary file (with `O_TMPFILE`) in `XDG_CACHE_HOME`. If we
+/// cannot create the file there it will be created in `/tmp` instead.
 pub fn create_tmp_file() -> std::io::Result<std::fs::File> {
     static TMP_PATH: OnceLock<std::path::PathBuf> = OnceLock::new();
     let tmp_path = TMP_PATH.get_or_init(|| {
```


--
Maximiliano




More information about the pbs-devel mailing list