On Sun, Feb 12, 2023 at 04:19:43PM -0500, Jan Schaumann wrote: > Jan Schaumann <jscha...@netmeister.org> wrote: > > > The attached diff adds a flag "-c" (mnemonic "create, > > don't overwrite" or "continue where you left off"): > > Ugh, and once more without a race condition. [...]
Definitely O_EXCL and EEXIST, yes. But we still can fall into a hole in the sequence, fill it, and skip over the remaining part(s), thus interleaving our new and the preexisting files. I tried to wrap my brain around how to use a flag or two to detect detect this so that we can err out at the second part of the preexisting sequence, but the damage would have happened already. Maybe the programmer should be warned to use an exclusive directory for his (multiple) splits. -is