summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2001-07-06 14:03:09 +0000
committerGerd Moellmann <gerd@gnu.org>2001-07-06 14:03:09 +0000
commit6573d87f38186c1bb66e6bb05726ac7e846d77e8 (patch)
tree0d5b004cda68494364c7e6313ac69ab04f53cb2b /lisp
parent383191dbb01a6ad0b225099afe917183a19e665b (diff)
downloademacs-6573d87f38186c1bb66e6bb05726ac7e846d77e8.tar.gz
(ange-ftp-file-modtime): Ignore 226 responses
from the server. Call encode-time only when we are sure that we got a 213 response.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/net/ange-ftp.el31
2 files changed, 27 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4b0ecfe26be..949486c2f91 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2001-07-06 Gerd Moellmann <gerd@gnu.org>
+
+ * net/ange-ftp.el (ange-ftp-file-modtime): Ignore 226 responses
+ from the server. Call encode-time only when we are sure that we
+ got a 213 response.
+
2001-07-06 Simon Josefsson <jas@extundo.com>
* mail/sendmail.el (mail-specify-envelope-from): Doc fix.
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index a74a7799fa0..10b03a474cf 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -3426,18 +3426,29 @@ system TYPE.")
(ange-ftp-real-delete-file file))))
(defun ange-ftp-file-modtime (file)
+ "Return the modification time of remote file FILE.
+Value is (0 0) if the modification time cannot be determined."
(let* ((parsed (ange-ftp-ftp-name file))
+ ;; At least one FTP server (wu-ftpd) can return a "226
+ ;; Transfer complete" before the "213 MODTIME". Let's skip
+ ;; that.
+ (ange-ftp-skip-msgs (concat ange-ftp-skip-msgs "\\|^226"))
(res (ange-ftp-send-cmd (car parsed) (cadr parsed)
- (list 'quote "mdtm" (cadr (cdr parsed))))))
- (if (= ?5 (aref (cdr res) 0)) '(0 0)
- (encode-time ; MDTM returns "YYYYMMDDHHMMSS" GMT
- (string-to-number (substring (cdr res) 16 18))
- (string-to-number (substring (cdr res) 14 16))
- (string-to-number (substring (cdr res) 12 14))
- (string-to-number (substring (cdr res) 10 12))
- (string-to-number (substring (cdr res) 8 10))
- (string-to-number (substring (cdr res) 4 8))
- 0))))
+ (list 'quote "mdtm" (cadr (cdr parsed)))))
+ (line (cdr res))
+ (modtime '(0 0)))
+ (when (string-match "^213" line)
+ ;; MDTM should return "213 YYYYMMDDhhmmss" GMT on success.
+ (setq modtime
+ (encode-time
+ (string-to-number (substring line 16 18))
+ (string-to-number (substring line 14 16))
+ (string-to-number (substring line 12 14))
+ (string-to-number (substring line 10 12))
+ (string-to-number (substring line 8 10))
+ (string-to-number (substring line 4 8))
+ 0)))
+ modtime))
(defun ange-ftp-verify-visited-file-modtime (buf)
(let ((name (buffer-file-name buf)))