Avoid a race condition while waiting for the connection string.
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Sun, 19 Sep 2010 19:36:10 +0000 (21:36 +0200)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Sun, 19 Sep 2010 19:36:10 +0000 (21:36 +0200)
lisp/ChangeLog
lisp/nnimap.el

index 3325811..0b13aa6 100644 (file)
@@ -1,5 +1,8 @@
 2010-09-19  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * nnimap.el (nnimap-wait-for-connection): Avoid a race condition while
+       waiting for the connection string.
+
        * gnus-html.el (gnus-html-image-fetched): Protect against the data not
        arriving.
 
index 776ed7f..b3a9e5b 100644 (file)
@@ -875,11 +875,12 @@ textual parts.")
     (goto-char (point-min))
     (while (and (memq (process-status process)
                      '(open run))
-               (not (re-search-forward "^\\* " nil t)))
+               (not (re-search-forward "^\\* .*\n" nil t)))
       (nnheader-accept-process-output process)
       (goto-char (point-min)))
-    (and (looking-at "[A-Z0-9]+")
-        (match-string 0))))
+    (forward-line -1)
+    (and (looking-at "\\* \\([A-Z0-9]+\\)")
+        (match-string 1))))
 
 (defun nnimap-wait-for-response (sequence &optional messagep)
   (let ((process (get-buffer-process (current-buffer))))