bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Use of `mktemp' is dangerous, better use `mkstemp'...


From: Chet Ramey
Subject: Re: Use of `mktemp' is dangerous, better use `mkstemp'...
Date: Sun, 17 Jan 2021 15:33:33 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.6.0

On 1/15/21 4:00 PM, Ángel wrote:
On 2021-01-15 at 10:00 -0500, Chet Ramey wrote:
On 1/14/21 11:45 PM, Jeffrey Walton wrote:
Hi Everyone,

I'm building Bash 5.1 from sources. This may be of interest:

/usr/bin/ld: ./lib/sh/libsh.a(tmpfile.o): in function
`sh_mktmpname':
/home/jwalton/Build-Scripts/bash-5.1/lib/sh/tmpfile.c:160: warning:
the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'

It's a spurious warning.

mktemp() would only end up being used (with all its issues) if the OS
doesn't provide a DEV FD or there's no mkdtemp(). In other (safe)
Operating Systems, it would be possible to avoid the warning by
building a slightly different libsh.a in such case.

The warning can be ignored.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]