QAbstractGeoTileCache: don't create files with predicatable names


While the check didn't explicitly write to the file, an OpenMode of
WriteOnly implies Truncate, so it in fact did empty the file. If the
file existed and e.g. was a symlink to an important file, an
application with elevated privileges could be used to clobber an
important file.

Fix by using a QTemporaryFile. This also takes care of auto-removing
the file, so we don't need the explicit remove() anymore.

Also check the return value of mkpath() - if mkpath() fails, we don't
succeed in creating a file there, so fail faster.

Amends e9753c6cfd5a0a7fa1c73c19459b815c59a1d6dd(!).

Pick-to: 6.9 6.8 6.5 6.2 5.15
Change-Id: I8c211d161980b2cfcc5839ac88780b3d8b2e4e5c
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
commit4e63e119604079fc47266c663d8edb14f3d4a23c
parentcbae29030504daa93e97145f140c7acb74ad9a34
authorMarc Mutz <marc.mutz@qt.io>
committerMarc Mutz <marc.mutz@qt.io>
commit timeMon, 13 Jan 2025 18:21:11 +0100