On 13 April 2014 16:41, Denys Vlasenko <[email protected]> wrote:
> On Tue, Apr 8, 2014 at 3:11 PM, Bernhard Reutner-Fischer
> <[email protected]> wrote:
>> +       if (opts & OPT_d) {
>>                 if (mkdtemp(chp) == NULL)
>>                         goto error;
>> +               if (opts & OPT_u)
>> +                       rmdir(chp);
>
> This is a change in behavior - now we would
> actually create, and then immediately delete the directory
> if run as "mktemp -du".
>
> I have mixed feelings about that.
> Do you think it's ok?

I think it's ok, yes. The race-window is about the same as
before, the creat()/unlink() do make it a bit slower but that
is IMO ok.
An alternative would be to export a uClibc-specific
__gen_tempname() function to avoid all those duplicate implementations
(in busybox, coreutils etc, etc) but i don't really think it's worth the effort
given that only mktemp(1) has something like it's -u and -u
obviously should not be used in the first place (due to races).
I fear that the (IMO) "correct" fix, i.e. removing -u, potentially breaks quite
some scripts, so unlink/rmdir seems to be the least intrusive thing to
do right now.

Makes sense?

thanks,
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to