Files
nwipe/src
Fabian Druschke 26e5cb9894 feat(pdf): automatically create PDF report directory if missing and improve permission model
This commit enhances the handling of the `-P /path` / `--PDFreportpath` option by
ensuring that nwipe can create the specified directory if it does not already
exist. Previously, nwipe simply called `access(path, W_OK)` and exited with a
generic “not a writeable directory” error if the directory did not exist or was
not writable. This caused ambiguity and prevented the use of custom report paths
without pre-creating them externally.

Key improvements:

- Added a new helper function `nwipe_ensure_directory()` that:
  - Differentiates between “non-existent”, “not a directory”, and “not writable”.
  - Attempts to create the directory recursively (`mkdir -p` style) when absent.
  - Creates directories with mode 0755 so other users can read/list directory contents.
  - Performs final verification that the directory exists, is a directory, and writable.

- Replaced the previous simple `access()` check in `nwipe.c` with the new
  directory-ensure logic.

- Introduces clearer and more helpful error messages when directory creation or
  permission checks fail.

Benefits:

- Users can now safely specify custom report paths (e.g. `-P /reports` or
  USB-mounted paths) without requiring manual pre-creation.
- Eliminates ambiguous error reporting and improves overall user experience.
- Maintains backward-compatible behavior when the target directory already exists.
2025-12-09 10:40:06 +01:00
..
2023-10-20 00:56:35 +02:00
2025-11-18 18:44:41 +00:00
2023-11-01 19:39:43 +00:00
2025-11-28 16:09:07 +01:00
2023-10-12 21:15:31 +02:00
2025-11-26 21:14:23 +00:00
2023-03-08 23:30:14 +00:00
2025-11-18 18:44:41 +00:00
2025-11-18 18:44:41 +00:00
2025-07-27 17:45:11 +08:00
2023-11-03 22:47:29 +01:00
2025-11-29 21:00:27 +01:00
2020-01-05 19:11:24 -05:00
2023-02-28 00:02:01 +00:00
2024-03-20 17:48:55 -03:00
2023-10-22 00:25:01 +01:00
2025-12-08 21:26:19 +00:00