diff options
| author | Lars Ingebrigtsen | 2018-04-14 21:55:08 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2018-04-14 21:55:08 +0200 |
| commit | f939cd025539791ad9af34b43af029a4f3d04f5f (patch) | |
| tree | 04f572aabb8254bab8f8fa3c247283ace5a44eb5 /src | |
| parent | 94b9fe59986c368ac2bb1024d3487dea73658788 (diff) | |
| download | emacs-f939cd025539791ad9af34b43af029a4f3d04f5f.tar.gz emacs-f939cd025539791ad9af34b43af029a4f3d04f5f.zip | |
Make call-process work if exec-path is nil
* src/lread.c (openp): If exec-path is nil, no files would be
found to execute (bug#30564).
Test cases:
(let ((exec-path ()))
(call-process "/bin/ls" nil (current-buffer)))
This would previously fail, but now works.
(let ((exec-path '("/bin/")))
(call-process "ls" nil (current-buffer)))
This worked, and still works.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lread.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lread.c b/src/lread.c index 8fb61f56338..8019443c09f 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -1587,11 +1587,14 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, | |||
| 1587 | 1587 | ||
| 1588 | absolute = complete_filename_p (str); | 1588 | absolute = complete_filename_p (str); |
| 1589 | 1589 | ||
| 1590 | for (; CONSP (path); path = XCDR (path)) | 1590 | do |
| 1591 | { | 1591 | { |
| 1592 | ptrdiff_t baselen, prefixlen; | 1592 | ptrdiff_t baselen, prefixlen; |
| 1593 | 1593 | ||
| 1594 | filename = Fexpand_file_name (str, XCAR (path)); | 1594 | if (NILP (path)) |
| 1595 | filename = str; | ||
| 1596 | else | ||
| 1597 | filename = Fexpand_file_name (str, XCAR (path)); | ||
| 1595 | if (!complete_filename_p (filename)) | 1598 | if (!complete_filename_p (filename)) |
| 1596 | /* If there are non-absolute elts in PATH (eg "."). */ | 1599 | /* If there are non-absolute elts in PATH (eg "."). */ |
| 1597 | /* Of course, this could conceivably lose if luser sets | 1600 | /* Of course, this could conceivably lose if luser sets |
| @@ -1768,7 +1771,8 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, | |||
| 1768 | } | 1771 | } |
| 1769 | if (absolute) | 1772 | if (absolute) |
| 1770 | break; | 1773 | break; |
| 1771 | } | 1774 | path = XCDR (path); |
| 1775 | } while (CONSP (path)); | ||
| 1772 | 1776 | ||
| 1773 | SAFE_FREE (); | 1777 | SAFE_FREE (); |
| 1774 | errno = last_errno; | 1778 | errno = last_errno; |