diff options
| author | Richard M. Stallman | 1993-06-19 01:23:59 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-06-19 01:23:59 +0000 |
| commit | a2c1fc584a48e0b335aba677e54bc358a8760c3e (patch) | |
| tree | 1e5a2c14a63cc09a64b90f5c9ecb3b85c4806eaf | |
| parent | 5e180bc02c0ea7e338c00cdb56204ef72c548fb3 (diff) | |
| download | emacs-a2c1fc584a48e0b335aba677e54bc358a8760c3e.tar.gz emacs-a2c1fc584a48e0b335aba677e54bc358a8760c3e.zip | |
(rmail-output): Check file can be read before trying to read part of it.
| -rw-r--r-- | lisp/mail/rmailout.el | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lisp/mail/rmailout.el b/lisp/mail/rmailout.el index fa6bf01bf39..f97cb2dcb04 100644 --- a/lisp/mail/rmailout.el +++ b/lisp/mail/rmailout.el | |||
| @@ -162,13 +162,14 @@ When called from lisp code, N may be omitted." | |||
| 162 | ;; If we can do it, read a little of the file | 162 | ;; If we can do it, read a little of the file |
| 163 | ;; to check whether it is an RMAIL file. | 163 | ;; to check whether it is an RMAIL file. |
| 164 | ;; If it is, don't mess it up. | 164 | ;; If it is, don't mess it up. |
| 165 | (insert-file-contents file-name nil 0 20) | 165 | (and (file-readable-p file-name) |
| 166 | (if (looking-at "BABYL OPTIONS:\n") | 166 | (progn (insert-file-contents file-name nil 0 20) |
| 167 | (error (save-excursion | 167 | (looking-at "BABYL OPTIONS:\n")) |
| 168 | (set-buffer rmailbuf) | 168 | (error (save-excursion |
| 169 | (substitute-command-keys | 169 | (set-buffer rmailbuf) |
| 170 | "Use \\[rmail-output-to-rmail-file] to output to Rmail file `%s'")) | 170 | (substitute-command-keys |
| 171 | (file-name-nondirectory file-name))) | 171 | "Use \\[rmail-output-to-rmail-file] to output to Rmail file `%s'")) |
| 172 | (file-name-nondirectory file-name))) | ||
| 172 | (erase-buffer) | 173 | (erase-buffer) |
| 173 | (insert-buffer-substring rmailbuf) | 174 | (insert-buffer-substring rmailbuf) |
| 174 | (insert "\n") | 175 | (insert "\n") |