Importing gnus-5.6.2
[elisp/gnus.git-] / lisp / nntp.el
index 8394547..8f10d3e 100644 (file)
@@ -236,6 +236,7 @@ server there that you can connect to.  See also
   "Record the command STRING."
   (save-excursion
     (set-buffer (get-buffer-create "*nntp-log*"))
+    (goto-char (point-max))
     (insert (format-time-string "%Y%m%dT%H%M%S" (current-time))
            " " nntp-address " " string "\n")))
 
@@ -244,8 +245,9 @@ server there that you can connect to.  See also
   (save-excursion
     (set-buffer (process-buffer process))
     (goto-char (point-min))
-    (while (or (not (memq (char-after (point)) '(?2 ?3 ?4 ?5)))
-              (looking-at "480"))
+    (while (and (or (not (memq (char-after (point)) '(?2 ?3 ?4 ?5)))
+                   (looking-at "480"))
+               (memq (process-status process) '(open run)))
       (when (looking-at "480")
        (nntp-handle-authinfo process))
       (nntp-accept-process-output process)
@@ -256,7 +258,7 @@ server there that you can connect to.  See also
          (progn
            (nntp-snarf-error-message)
            nil))
-        ((memq (process-status process) '(open run))
+        ((not (memq (process-status process) '(open run)))
          (nnheader-report 'nntp "Server closed connection"))
         (t
          (goto-char (point-max))