On Fri, Mar 30, 2018 at 04:01:56PM +0200, Johannes Schindelin wrote:

> You know what is *really* funny?
> 
> -- snip --
> static int git_config_from_stdin(config_fn_t fn, void *data)
> {
>         return do_config_from_file(fn, CONFIG_ORIGIN_STDIN, "", NULL, stdin, 
> data, 0);
> }
> 
> int git_config_from_file(config_fn_t fn, const char *filename, void *data)
> {
>         int ret = -1;
>         FILE *f;
> 
>         f = fopen_or_warn(filename, "r");
>         if (f) {
>                 flockfile(f);
>                 ret = do_config_from_file(fn, CONFIG_ORIGIN_FILE, filename, 
> filename, f, data, 0);
>                 funlockfile(f);
>                 fclose(f);
>         }
>         return ret;
> }
> -- snap --
> 
> So the _stdin variant *goes out of its way not to flockfile()*...

*facepalm* That's probably my fault, since git_config_from_stdin()
existed already when I did the flockfile stuff.

Probably the flockfile should go into do_config_from_file(), where we
specify to use the unlocked variants.

> But I guess all this will become moot when I start handing down the config
> options. It does mean that I have to change the signatures in header
> files, oh well ;-)
> 
> But then I can drop this here patch and we can stop musing about
> flockfile()  ;-)

Yeah, I'll wait to see how your refactor turns out.

-Peff

Reply via email to