Ticket #3354 (closed defect: fixed)
Need better handling of temporary files
|Reported by:||dmorissette||Owned by:||dmorissette|
|Component:||Documentation - MapServer||Version:||unspecified|
|Cc:||sdlime, assefa, aboudreault, havatv|
At the moment, we write some temporary files in the web-accessible IMAGEPATH directory, this was a poor practice but still okay for some uses in the past (such as writing CONNECTIONTYPE WMS and WFS responses while we process them), but as our need for temporary files increase, we need to ensure that temp files are handled in a proper and safer way.
One option could be to adopt the use of a $MS_TMPDIR environment variable to specify the temporary directory path. If $MS_TMPDIR is not set, then we would fallback on $TMPDIR (commonly used on Unix), and if not, on /tmp on Unix/Linux?, or some path TBD on Windows.
We could also look into the use of system calls to more safely handle temp files. One possibility is tmpfile(), but the drawback of this one is that it automatically deletes the files once it's closed and in some cases we don't want that.