On Sun, Apr 11, 2021 at 2:31 PM Laurent Bercot <ska-skaw...@skarnet.org> wrote:
>   Fixed in git, please try it and tell me if it works for you.
> (I simply made the getutx*() functions stay on the current record on
> success, instead of pointing to the next record.)

Thanks for the quick changes.

So the good news is that putuxline() following getuxid() or
getuxline() correctly overwrites the matched record.
The bad news is that getutxent() is suffering from a self-inflicted DoS :)

setutxent(); while (getutxent());

will give you an infinite loop (reading the first record over and over again).

I'd suggest another approach that should work better, at least on
paper: instead of doing onestepback() at the end of each do_getutx*(),
revert those changes and do onestepback() in do_putline() before
entering the idmatch() loop - taking care to ignore the failure
(EINVAL) of onestepback() if we're at the start of database.

There may be scenarios where this may not be correct. I haven't
thought it through properly.

Unless you have other ideas you'd rather try, I'll experiment with
this approach a bit and let you know the results. In the meantime you
may want to back out your commit because it's pretty broken right now

Reply via email to