Merge branch 'cb/fsmonitor-intfix'
authorJunio C Hamano <gitster@pobox.com>
Tue, 9 Jul 2019 22:25:38 +0000 (15:25 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 9 Jul 2019 22:25:38 +0000 (15:25 -0700)
Variable type fix.

* cb/fsmonitor-intfix:
fsmonitor: avoid signed integer overflow / infinite loop

1  2 
fsmonitor.c
diff --combined fsmonitor.c
index 1dee0aded1c433c7cfb90195328f270559c9b421,df55d9dc2293615361b12b1e41219a479c1f073e..231e83a94db58e4efb2f4d7a1dbe90220bd2f317
@@@ -56,7 -56,7 +56,7 @@@ int read_fsmonitor_extension(struct ind
  
  void fill_fsmonitor_bitmap(struct index_state *istate)
  {
-       int i;
+       unsigned int i;
        istate->fsmonitor_dirty = ewah_new();
        for (i = 0; i < istate->cache_nr; i++)
                if (!(istate->cache[i]->ce_flags & CE_FSMONITOR_VALID))
@@@ -129,16 -129,17 +129,16 @@@ static void fsmonitor_refresh_callback(
  
  void refresh_fsmonitor(struct index_state *istate)
  {
 -      static int has_run_once = 0;
        struct strbuf query_result = STRBUF_INIT;
        int query_success = 0;
        size_t bol; /* beginning of line */
        uint64_t last_update;
        char *buf;
-       int i;
+       unsigned int i;
  
 -      if (!core_fsmonitor || has_run_once)
 +      if (!core_fsmonitor || istate->fsmonitor_has_run_once)
                return;
 -      has_run_once = 1;
 +      istate->fsmonitor_has_run_once = 1;
  
        trace_printf_key(&trace_fsmonitor, "refresh fsmonitor");
        /*
  
  void add_fsmonitor(struct index_state *istate)
  {
-       int i;
+       unsigned int i;
  
        if (!istate->fsmonitor_last_update) {
                trace_printf_key(&trace_fsmonitor, "add fsmonitor");
@@@ -225,7 -226,7 +225,7 @@@ void remove_fsmonitor(struct index_stat
  
  void tweak_fsmonitor(struct index_state *istate)
  {
-       int i;
+       unsigned int i;
        int fsmonitor_enabled = git_config_get_fsmonitor();
  
        if (istate->fsmonitor_dirty) {