Fix : gp_gettmpdir was inconsistent to gp_open_scratch_file.

"Igor V. Melichev" <[email protected]>
Newsgroups gmane.comp.printing.ghostscript.patches
Message-ID <[email protected]>
This is a preliminary publication.
The patch was not tested on some platforms.


[Log message beg]
Fix : gp_gettmpdir was inconsistent to gp_open_scratch_file.

DETAILS :

The old code wrongly implemented gp_gettmpdir, returning a result
inconsistent with one assumed by gp_open_scratch_file.
Particularly on Unix when TMPDIR, TEMP environment variables are not set,
it retrieved an empty string while gp_open_scratch_file places files to
/tmp/ .
This caused a security hole.

The new code provides a platform dependent code for gp_gettmpdir,
and splits gp_open_scratch_file into 2 functions :
gp_open_scratch_file compatible to the old implementation except for
ztempfile,
and gp_open_scratch_file_generic, which allows clients to tell whether the
prefix is bare
(i.e. starts neither from root nor from cwd nor from parent).

Now the logics of ztempfile is straight-forward :

- obtain a path for scratch file;
- check it for permissions, unless it is in a temp directory;
- open a scratch file on the obtained path.
[Log message end]
patch.txt .dat (application/octet-stream, 16.9 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.