test-drop-caches: simplify delay loading of NtSetSystemInformation
[gitweb.git] / config.c
index c698988f5e11cd416bef9a77c998d94b9ef87930..62c56099bf82c44aefc7f4dcdba207a66ad76cd7 100644 (file)
--- a/config.c
+++ b/config.c
@@ -9,7 +9,7 @@
 #include "config.h"
 #include "repository.h"
 #include "lockfile.h"
-#include "exec_cmd.h"
+#include "exec-cmd.h"
 #include "strbuf.h"
 #include "quote.h"
 #include "hashmap.h"
@@ -1426,6 +1426,7 @@ static int do_config_from_file(config_fn_t fn,
                void *data)
 {
        struct config_source top;
+       int ret;
 
        top.u.file = f;
        top.origin_type = origin_type;
@@ -1436,7 +1437,10 @@ static int do_config_from_file(config_fn_t fn,
        top.do_ungetc = config_file_ungetc;
        top.do_ftell = config_file_ftell;
 
-       return do_config_from(&top, fn, data);
+       flockfile(f);
+       ret = do_config_from(&top, fn, data);
+       funlockfile(f);
+       return ret;
 }
 
 static int git_config_from_stdin(config_fn_t fn, void *data)
@@ -1451,9 +1455,7 @@ int git_config_from_file(config_fn_t fn, const char *filename, void *data)
 
        f = fopen_or_warn(filename, "r");
        if (f) {
-               flockfile(f);
                ret = do_config_from_file(fn, CONFIG_ORIGIN_FILE, filename, filename, f, data);
-               funlockfile(f);
                fclose(f);
        }
        return ret;