]> git.eshelyaron.com Git - emacs.git/commitdiff
Make docview error message clearer
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Sat, 16 Jul 2011 19:38:25 +0000 (21:38 +0200)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Sat, 16 Jul 2011 19:38:25 +0000 (21:38 +0200)
* doc-view.el (doc-view-make-safe-dir): Rewrite the error message
to clarify what the problem is (bug#4291).

lisp/ChangeLog
lisp/doc-view.el

index 6ac0dd3d0b1c99193da569f5b277dbf68cd4bcbb..48f61a55552cd3d0b1f861faf7a43950577ffde8 100644 (file)
@@ -1,5 +1,8 @@
 2011-07-16  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * doc-view.el (doc-view-make-safe-dir): Rewrite the error message
+       to clarify what the problem is (bug#4291).
+
        * simple.el (current-kill): Clarify what
        `interprogram-paste-function' does (bug#7500).
        (auto-fill-mode): Document `auto-fill-function' in relation to
index 666c6a8b03446e078b3e05ea78b244450d1d3c00..872b2172c7e3f2eae62b8669770f6d9f29499db3 100644 (file)
@@ -569,18 +569,18 @@ at the top edge of the page moves to the previous page."
 (defun doc-view-make-safe-dir (dir)
   (condition-case nil
       (let ((umask (default-file-modes)))
-        (unwind-protect
-            (progn
-              ;; Create temp files with strict access rights.  It's easy to
-              ;; loosen them later, whereas it's impossible to close the
-              ;; time-window of loose permissions otherwise.
-              (set-default-file-modes #o0700)
-              (make-directory dir))
-          ;; Reset the umask.
-          (set-default-file-modes umask)))
+       (unwind-protect
+           (progn
+             ;; Create temp files with strict access rights.  It's easy to
+             ;; loosen them later, whereas it's impossible to close the
+             ;; time-window of loose permissions otherwise.
+             (set-default-file-modes #o0700)
+             (make-directory dir))
+         ;; Reset the umask.
+         (set-default-file-modes umask)))
     (file-already-exists
-     (if (file-symlink-p dir)
-         (error "Danger: %s points to a symbolic link" dir))
+     (when (file-symlink-p dir)
+       (error "Danger: %s points to a symbolic link" dir))
      ;; In case it was created earlier with looser rights.
      ;; We could check the mode info returned by file-attributes, but it's
      ;; a pain to parse and it may not tell you what we want under
@@ -589,7 +589,12 @@ at the top edge of the page moves to the previous page."
      ;; This also ends up checking a bunch of useful conditions: it makes
      ;; sure we have write-access to the directory and that we own it, thus
      ;; closing a bunch of security holes.
-     (set-file-modes dir #o0700))))
+     (condition-case error
+        (set-file-modes dir #o0700)
+       (file-error
+       (error
+        (format "Unable to use temporary directory %s: %s"
+                dir (mapconcat 'identity (cdr error) " "))))))))
 
 (defun doc-view-current-cache-dir ()
   "Return the directory where the png files of the current doc should be saved.