in reply to Re^4: A DWIM too far?
in thread A DWIM too far?

Personally I would prefer rename to fail by default with an option to overwrite. It would make my code more robust.
You'd still get the race condition, unless the underlying C API call was atomic - and we've seen that in a lot of cases this isn't the case (i.e. you'd first have to check for the file's existence, hence the race condition.)

Michael

Replies are listed 'Best First'.
Re^6: A DWIM too far?
by adrianh (Chancellor) on Jun 18, 2004 at 14:14 UTC
    You'd still get the race condition, unless the underlying C API call was atomic

    I'd hoped that it would have been obvious that this would need to be implemented without using rename(2) :-)