Reinstate the use of $TMPDIR and $TMP in cursor positioning rather than hard-coding "/tmp" (#88).
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
### NOT YET RELEASED
|
||||
|
||||
* feature: new "`--si`" option to display and interpret size suffixes in multiples of 1000 rather than 1024 (pull request [#85](https://codeberg.org/a-j-wood/pv/pulls/85)) supplied by [kevinruddy](https://codeberg.org/kevinruddy)
|
||||
* fix: honour the _TMPDIR_ / _TMP_ environment variables again, rather than hard-coding "`/tmp`", when using a terminal lock file (originally removed in 1.8.0) ([#88](https://codeberg.org/a-j-wood/pv/issues/88))
|
||||
* i18n: corrections and missing strings added to French translations (pull request [#83](https://codeberg.org/a-j-wood/pv/pulls/83)) supplied by [Thomas Bertels](https://codeberg.org/tbertels)
|
||||
|
||||
### 1.8.5 - 19 November 2023
|
||||
|
||||
+8
-6
@@ -95,14 +95,16 @@ static void pv_crs_open_lockfile(pvstate_t state, int fd)
|
||||
return;
|
||||
}
|
||||
|
||||
tmpdir = (char *) getenv("TMPDIR"); /* flawfinder: ignore */
|
||||
if ((NULL == tmpdir) || ('\0' == tmpdir[0]))
|
||||
tmpdir = (char *) getenv("TMP"); /* flawfinder: ignore */
|
||||
if ((NULL == tmpdir) || ('\0' == tmpdir[0]))
|
||||
tmpdir = "/tmp";
|
||||
|
||||
/*
|
||||
* We used to look at the TMPDIR or TMP environment variables to
|
||||
* override the temporary directory, but this leads to less
|
||||
* predictable behaviour, and flawfinder points out that relying on
|
||||
* environment variables in this way is not safe. So the lock
|
||||
* directory is hard-coded to "/tmp" now (Sep 2023).
|
||||
* flawfinder rationale: null and zero-size values of $TMPDIR and
|
||||
* $TMP are rejected, and the destination buffer is bounded.
|
||||
*/
|
||||
tmpdir = "/tmp";
|
||||
|
||||
memset(state->cursor.lock_file, 0, PV_SIZEOF_CRS_LOCK_FILE);
|
||||
(void) pv_snprintf(state->cursor.lock_file,
|
||||
|
||||
Reference in New Issue
Block a user