(Just for context for the follow-up) I am not sure how “clean” the code in
#28006 is. Maybe an easier alternative might be to remove all calls to
Get and instead wrap the calls that acted on
FILE* into a lambda (which acts on
FILE*) and pass the lambda to an
Exec() member function. The
Exec() function would then also reset the cached
ftell state and force a call to
ftell the next time it is needed. On top of requiring that the constructor takes a
FILE*&& (taking ownership), this should be a relatively easy to review complete fix.