[Issue 24315] dmd/cpreprocess.d:87: warning: the use of `tmpnam' is dangerous, better use `mkstemp'

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 3 20:14:34 UTC 2024


https://issues.dlang.org/show_bug.cgi?id=24315

kdevel <kdevel at vogtner.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kdevel at vogtner.de

--- Comment #4 from kdevel <kdevel at vogtner.de> ---
(In reply to Walter Bright from comment #2)
> The problem with using mkstemp() is it returns a file descriptor. I need it
> to return a file name.

It returns the file name, too: [1] [2] [3] [4]

[1] https://pubs.opengroup.org/onlinepubs/009604499/functions/mkstemp.html
"The string in template should look like a filename with six trailing 'X' s;
mkstemp() replaces each 'X' with a character from the portable filename
character set."
[2]
https://forum.dlang.org/post/mailman.4798.1421530338.9932.digitalmars-d-learn@puremagic.com
"Getting a safe path for a temporary file"
[3]
https://forum.dlang.org/post/mailman.667.1343269970.31962.digitalmars-d@puremagic.com
"temporary files - what is the resolution?"
[4] https://www.gnu.org/software/gnulib/manual/html_node/mkstemp.html

--


More information about the Digitalmars-d-bugs mailing list