]> granicus.if.org Git - vim/commitdiff
patch 8.0.1439: if cscope fails a search Vim may hang v8.0.1439
authorBram Moolenaar <Bram@vim.org>
Tue, 30 Jan 2018 20:47:52 +0000 (21:47 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 30 Jan 2018 20:47:52 +0000 (21:47 +0100)
Problem:    If cscope fails a search Vim may hang.
Solution:   Bail out when a search error is encountered. (Safouane Baroudi,
            closes #2598)

src/if_cscope.c
src/version.c

index 168b3e49e326340cfde5759d22e7a725b995c695..9466c34f9d015cfac54623fb69b4c3a3dd117f9b 100644 (file)
@@ -677,7 +677,7 @@ cs_cnt_matches(int idx)
 {
     char *stok;
     char *buf;
-    int nlines;
+    int nlines = 0;
 
     buf = (char *)alloc(CSREAD_BUFSIZE);
     if (buf == NULL)
@@ -700,7 +700,10 @@ cs_cnt_matches(int idx)
         * cscope will output error messages before the number-of-lines output.
         * Display/discard any output that doesn't match what we want.
         * Accept "\S*cscope: X lines", also matches "mlcscope".
+        * Bail out for the "Unable to search" error.
         */
+       if (strstr((const char *)stok, "Unable to search database") != NULL)
+           break;
        if ((stok = strtok(buf, (const char *)" ")) == NULL)
            continue;
        if (strstr((const char *)stok, "cscope:") == NULL)
index f66cf456646f264ff62a02f2ce6dbf0366435d98..09fb3005693ea3566fae7a7e207406ce572ca0f9 100644 (file)
@@ -771,6 +771,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1439,
 /**/
     1438,
 /**/