aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/mail/rmailout.el
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>1993-06-19 01:23:59 +0000
committerRichard M. Stallman <[email protected]>1993-06-19 01:23:59 +0000
commita2c1fc584a48e0b335aba677e54bc358a8760c3e (patch)
tree1e5a2c14a63cc09a64b90f5c9ecb3b85c4806eaf /lisp/mail/rmailout.el
parent5e180bc02c0ea7e338c00cdb56204ef72c548fb3 (diff)
(rmail-output): Check file can be read before trying to read part of it.
Diffstat (limited to 'lisp/mail/rmailout.el')
-rw-r--r--lisp/mail/rmailout.el15
1 files changed, 8 insertions, 7 deletions
diff --git a/lisp/mail/rmailout.el b/lisp/mail/rmailout.el
index fa6bf01bf3..f97cb2dcb0 100644
--- a/lisp/mail/rmailout.el
+++ b/lisp/mail/rmailout.el
@@ -162,13 +162,14 @@ When called from lisp code, N may be omitted."
;; If we can do it, read a little of the file
;; to check whether it is an RMAIL file.
;; If it is, don't mess it up.
- (insert-file-contents file-name nil 0 20)
- (if (looking-at "BABYL OPTIONS:\n")
- (error (save-excursion
- (set-buffer rmailbuf)
- (substitute-command-keys
- "Use \\[rmail-output-to-rmail-file] to output to Rmail file `%s'"))
- (file-name-nondirectory file-name)))
+ (and (file-readable-p file-name)
+ (progn (insert-file-contents file-name nil 0 20)
+ (looking-at "BABYL OPTIONS:\n"))
+ (error (save-excursion
+ (set-buffer rmailbuf)
+ (substitute-command-keys
+ "Use \\[rmail-output-to-rmail-file] to output to Rmail file `%s'"))
+ (file-name-nondirectory file-name)))
(erase-buffer)
(insert-buffer-substring rmailbuf)
(insert "\n")