Changed behavior of permissions for temp-file (created during compression) to
be more strict. This may not be important to most end-users.
+Added `--force-tmpfile`, which acts like `--temp-files-dir <dir>` but forces the
+use of `tmpdir()` instead of forcing the temporary file's directory.
+Note that these two flags are mutually exclusive.
+
## Version 1.17
Fix `--whitelist-begins-with <text>` and `--whitelist-ends-with <text>`.
--no-abs-symlink : do not store absolute paths for symlinks
--preserve-symlinks : preserve the symlink's path on archive creation instead of deriving abs/relative paths, ignores "--no-abs-symlink" (It is not recommended to use this option, as absolute-path-symlinks may be clobbered on extraction)
--no-safe-links : keep symlinks that link to outside archive contents
- --temp-files-dir <dir> : where to store temporary files created when compressing (defaults to same directory as output file)
+ --temp-files-dir <dir> : where to store temporary files created when compressing (defaults to same directory as output file) (this is mutually exclusive with "--force-tmpfile")
+ --force-tmpfile : Force the use of "tmpfile()" during compression (this is mutually exclusive with "--temp-files-dir")
--write-version <version> : Force write version file format (default 4)
--chunk-min-size <bytes> : minimum chunk size (default 4194304 or 4MiB) when using chunks (file formats v. 1 and up)
--no-pre-sort-files : do NOT pre-sort files by size (by default enabled so that the first file is the largest)
FILE *simple_archiver_helper_temp_dir(const SDArchiverParsed *parsed,
char **out_temp_filename) {
+ if (parsed->flags & 0x40000) {
+ return tmpfile();
+ }
+
__attribute__((cleanup(simple_archiver_helper_cleanup_c_string)))
char *real_path_to_filename = parsed->temp_dir
? strdup(parsed->temp_dir)
return 6;
}
+ if (parsed.temp_dir && (parsed.flags & 0x40000)) {
+ fprintf(stderr,
+ "ERROR: \"--temp-files-dir\" and \"--force-tmpfile\" is mutually "
+ "exclusive!\n");
+ sleep(2);
+ simple_archiver_print_usage();
+ return 9;
+ }
+
if ((parsed.flags & 0x3) == 0 && (parsed.flags & 0x2000) != 0) {
fprintf(stderr,
"WARNING: --force-dir-permissions specified, but has no effect "
"contents\n");
fprintf(stderr,
"--temp-files-dir <dir> : where to store temporary files created "
- "when compressing (defaults to same directory as output file)\n");
+ "when compressing (defaults to same directory as output file) "
+ "(this is mutually exclusive with \"--force-tmpfile\")\n");
+ fprintf(stderr,
+ "--force-tmpfile : Force the use of \"tmpfile()\" during "
+ "compression (this is mutually exclusive with \"--temp-files-dir\")"
+ "\n");
fprintf(stderr,
"--write-version <version> : Force write version file format "
"(default 4)\n");
out->temp_dir = simple_archiver_helper_real_path_to_name(argv[1]);
--argc;
++argv;
+ } else if (strcmp(argv[0], "--force-tmpfile") == 0) {
+ out->flags |= 0x40000;
} else if (strcmp(argv[0], "--write-version") == 0) {
if (argc < 2) {
fprintf(stderr,
/// 0b xxxx xxx1 xxxx xxxx xxxx xxxx - Force set empty directory permissions.
/// 0b xxxx xx1x xxxx xxxx xxxx xxxx - white/black-list checking is
/// case-insensitive.
+ /// 0b xxxx x1xx xxxx xxxx xxxx xxxx - Force use tmpfile.
uint32_t flags;
/// Null-terminated string.
char *filename;