diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/image.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/image.c b/src/image.c index c702782b64b..9970e5881e0 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -2292,7 +2292,19 @@ x_find_image_fd (Lisp_Object file, int *pfd) | |||
| 2292 | /* Try to find FILE in data-directory/images, then x-bitmap-file-path. */ | 2292 | /* Try to find FILE in data-directory/images, then x-bitmap-file-path. */ |
| 2293 | fd = openp (search_path, file, Qnil, &file_found, | 2293 | fd = openp (search_path, file, Qnil, &file_found, |
| 2294 | pfd ? Qt : make_number (R_OK), false); | 2294 | pfd ? Qt : make_number (R_OK), false); |
| 2295 | if (fd < 0) | 2295 | if (fd >= 0 || fd == -2) |
| 2296 | { | ||
| 2297 | file_found = ENCODE_FILE (file_found); | ||
| 2298 | if (fd == -2) | ||
| 2299 | { | ||
| 2300 | /* The file exists locally, but has a file handler. (This | ||
| 2301 | happens, e.g., under Auto Image File Mode.) 'openp' | ||
| 2302 | didn't open the file, so we should, because the caller | ||
| 2303 | expects that. */ | ||
| 2304 | fd = emacs_open (SSDATA (file_found), O_RDONLY | O_BINARY, 0); | ||
| 2305 | } | ||
| 2306 | } | ||
| 2307 | else /* fd < 0, but not -2 */ | ||
| 2296 | return Qnil; | 2308 | return Qnil; |
| 2297 | if (pfd) | 2309 | if (pfd) |
| 2298 | *pfd = fd; | 2310 | *pfd = fd; |