Temp dir falls back when TMPDIR or /tmp is unusable (Termux); v0.6.1
os_temp_dir() used $TMPDIR or "/tmp" without checking either. On Termux
/tmp usually does not exist (or SELinux denies it) unless TMPDIR points at
$PREFIX/tmp, so plugin and MCP temp files failed and shell children that
need a temp file (heredocs) broke.
* os_temp_dir() picks, once, the first of $TMPDIR, $PREFIX/tmp, /tmp,
/var/tmp and ~/.cache/cst-agent/tmp where a file can really be
created; if none works it keeps the old answer
* os_temp_dir_export() at startup writes the choice back to TMPDIR, so
shell children and the sandbox's writable temp dir agree
* tests/test_tmpdir.c covers the fallbacks in fresh forks
This commit is contained in:
@@ -192,6 +192,7 @@ int main(int argc, char **argv) {
|
||||
fprintf(stderr, "warning: the process code page is not UTF-8 (Windows 10 "
|
||||
"1903 or later is required); non-ASCII text may break\n");
|
||||
os_set_prog_path(argv[0]);
|
||||
os_temp_dir_export();
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
|
||||
cst_agent_config_t cfg = {0};
|
||||
|
||||
Reference in New Issue
Block a user