changeset 102574:f4063dcd103b

(get-free-disk-space): Ensure that default-directory is usable before calling call-process. Suggested by Kevin Ryde (Bug#2631).
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 15 Mar 2009 02:31:45 +0000
parents 7787d540233a
children 19d1ace1f9eb
files lisp/files.el
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/files.el	Sun Mar 15 02:29:23 2009 +0000
+++ b/lisp/files.el	Sun Mar 15 02:31:45 2009 +0000
@@ -5336,10 +5336,17 @@
       (save-match-data
 	(with-temp-buffer
 	  (when (and directory-free-space-program
-		     (eq 0 (call-process directory-free-space-program
+		     (let ((default-directory
+			     (if (and (not (file-remote-p default-directory))
+				      (file-directory-p default-directory)
+				      (file-readable-p default-directory))
+				 default-directory
+			       (expand-file-name "~/"))))
+		       (eq (call-process directory-free-space-program
 					 nil t nil
 					 directory-free-space-args
-					 dir)))
+					 dir)
+			   0)))
 	    ;; Usual format is a header line followed by a line of
 	    ;; numbers.
 	    (goto-char (point-min))