[systemd-devel] [RFC PATCH 1/2] Replace mkostemp+unlink with open(O_TMPFILE)
Zbigniew Jędrzejewski-Szmek
zbyszek at in.waw.pl
Mon Jan 27 09:40:39 PST 2014
On Mon, Jan 27, 2014 at 05:54:58PM +0100, Kay Sievers wrote:
> On Mon, Jan 27, 2014 at 5:35 PM, Zbigniew Jędrzejewski-Szmek
> <zbyszek at in.waw.pl> wrote:
> > On Mon, Jan 27, 2014 at 03:14:28PM +0100, Lennart Poettering wrote:
> >> Yupp, it's certainly a good idea to make our logging functions safe for
> >> execution in any context.
> >>
> >> What I don't understands though is why mkostemp() would not be safe here?
> > mkostemp is not on the list of "safe" functions. I looked at the
> > implementation, and it actually has a static variable, so it really
> > cannot be called.
>
> But does this matter here? The static var is still mixed with random.
> It seems it will work just fine, at least with the next iteration?
I guess it's a question whether we want to rely on a specific
implementation, or on the promises made by standards/documentation.
mkostemp might call the random number generator, which might modify some
global state, etc, which could be visible from outside of the signal handler.
It just feels risky to make promises about this.
writev should probably be safe... OTOH, it's trivial to reimplement.
Zbyszek
More information about the systemd-devel
mailing list