Details
Description
On macOS, if a process is launched via sudo with an empty $TMPDIR environment variable, QDir::tempPath() falls back to a hardcoded "/tmp" path, which might not be writable.
Correct writable temporary directory can be obtained via call to NSTemporaryDirectory()
Sample program is attached. It's output is below:
1. Normal execution
Qt tempPath: /var/folders/3z/jqb49r_56xz_ky8fqb55ccnh0000gn/T
Cocoa tempPath: /var/folders/3z/jqb49r_56xz_ky8fqb55ccnh0000gn/T/
2. sudo execution
Qt tempPath: /tmp
Cocoa tempPath: /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/
Attachments
Issue Links
- relates to
-
QTBUG-56807 QTemporaryFile with name template does not work on Mac OS X Sierra
- Closed