aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Moellmann2001-07-06 14:03:09 +0000
committerGerd Moellmann2001-07-06 14:03:09 +0000
commit6573d87f38186c1bb66e6bb05726ac7e846d77e8 (patch)
tree0d5b004cda68494364c7e6313ac69ab04f53cb2b
parent383191dbb01a6ad0b225099afe917183a19e665b (diff)
downloademacs-6573d87f38186c1bb66e6bb05726ac7e846d77e8.tar.gz
emacs-6573d87f38186c1bb66e6bb05726ac7e846d77e8.zip
(ange-ftp-file-modtime): Ignore 226 responses
from the server. Call encode-time only when we are sure that we got a 213 response.
-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 @@
12001-07-06 Gerd Moellmann <gerd@gnu.org>
2
3 * net/ange-ftp.el (ange-ftp-file-modtime): Ignore 226 responses
4 from the server. Call encode-time only when we are sure that we
5 got a 213 response.
6
12001-07-06 Simon Josefsson <jas@extundo.com> 72001-07-06 Simon Josefsson <jas@extundo.com>
2 8
3 * mail/sendmail.el (mail-specify-envelope-from): Doc fix. 9 * 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.")
3426 (ange-ftp-real-delete-file file)))) 3426 (ange-ftp-real-delete-file file))))
3427 3427
3428(defun ange-ftp-file-modtime (file) 3428(defun ange-ftp-file-modtime (file)
3429 "Return the modification time of remote file FILE.
3430Value is (0 0) if the modification time cannot be determined."
3429 (let* ((parsed (ange-ftp-ftp-name file)) 3431 (let* ((parsed (ange-ftp-ftp-name file))
3432 ;; At least one FTP server (wu-ftpd) can return a "226
3433 ;; Transfer complete" before the "213 MODTIME". Let's skip
3434 ;; that.
3435 (ange-ftp-skip-msgs (concat ange-ftp-skip-msgs "\\|^226"))
3430 (res (ange-ftp-send-cmd (car parsed) (cadr parsed) 3436 (res (ange-ftp-send-cmd (car parsed) (cadr parsed)
3431 (list 'quote "mdtm" (cadr (cdr parsed)))))) 3437 (list 'quote "mdtm" (cadr (cdr parsed)))))
3432 (if (= ?5 (aref (cdr res) 0)) '(0 0) 3438 (line (cdr res))
3433 (encode-time ; MDTM returns "YYYYMMDDHHMMSS" GMT 3439 (modtime '(0 0)))
3434 (string-to-number (substring (cdr res) 16 18)) 3440 (when (string-match "^213" line)
3435 (string-to-number (substring (cdr res) 14 16)) 3441 ;; MDTM should return "213 YYYYMMDDhhmmss" GMT on success.
3436 (string-to-number (substring (cdr res) 12 14)) 3442 (setq modtime
3437 (string-to-number (substring (cdr res) 10 12)) 3443 (encode-time
3438 (string-to-number (substring (cdr res) 8 10)) 3444 (string-to-number (substring line 16 18))
3439 (string-to-number (substring (cdr res) 4 8)) 3445 (string-to-number (substring line 14 16))
3440 0)))) 3446 (string-to-number (substring line 12 14))
3447 (string-to-number (substring line 10 12))
3448 (string-to-number (substring line 8 10))
3449 (string-to-number (substring line 4 8))
3450 0)))
3451 modtime))
3441 3452
3442(defun ange-ftp-verify-visited-file-modtime (buf) 3453(defun ange-ftp-verify-visited-file-modtime (buf)
3443 (let ((name (buffer-file-name buf))) 3454 (let ((name (buffer-file-name buf)))