Sujet : Re: Running an editor from ANSI C
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.cDate : 07. Jun 2024, 01:40:44
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v3tkub$1o860$4@dont-email.me>
References : 1 2 3 4 5 6 7 8 9
User-Agent : Pan/0.158 (Avdiivka; )
On Thu, 6 Jun 2024 15:35:53 +0100, Malcolm McLean wrote:
The only way I can get the Baby X shell to run nano is to use tmpnam().
I've tried mkstemp insteaad, and I just can't find a way.
mkstemp opens the temporary file, which is not much use if you want to run
an external program which requires a filename.
To solve the potential race conditions with creating temporary files, I
think the right solution is to use mkdtemp(3) instead. That creates and
returns the name of a temporary directory. Now you are free to create as
many files (and subdirectories) as you like with whatever names you like
within that, secure in the knowledge that nobody else can interfere with
you.