]> git.eshelyaron.com Git - emacs.git/commitdiff
(get-free-disk-space): Ensure that default-directory is
authorChong Yidong <cyd@stupidchicken.com>
Sun, 15 Mar 2009 02:31:45 +0000 (02:31 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Sun, 15 Mar 2009 02:31:45 +0000 (02:31 +0000)
usable before calling call-process.  Suggested by Kevin
Ryde (Bug#2631).

lisp/files.el

index 00207d63b245df42be930f76b0de836fe3983d29..eb7fe021e4b09301fbafd4ddb26f50921c140ed4 100644 (file)
@@ -5336,10 +5336,17 @@ program specified by `directory-free-space-program' if that is non-nil."
       (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))