]> git.eshelyaron.com Git - emacs.git/commitdiff
Resurrect image loading under auto-image-file-mode
authorEli Zaretskii <eliz@gnu.org>
Mon, 19 Oct 2015 13:15:30 +0000 (16:15 +0300)
committerEli Zaretskii <eliz@gnu.org>
Mon, 19 Oct 2015 13:15:30 +0000 (16:15 +0300)
* src/image.c (x_find_image_fd): Handle the case of -2 returned by
'openp' specially.  This special case was lost in the changes on
2015-08-18.  (Bug#21685)

src/image.c

index c702782b64ba412aa61925f1045efe3b247385df..9970e5881e0a7cac170578785b68af0cc4276a86 100644 (file)
@@ -2292,7 +2292,19 @@ x_find_image_fd (Lisp_Object file, int *pfd)
   /* Try to find FILE in data-directory/images, then x-bitmap-file-path.  */
   fd = openp (search_path, file, Qnil, &file_found,
              pfd ? Qt : make_number (R_OK), false);
-  if (fd < 0)
+  if (fd >= 0 || fd == -2)
+    {
+      file_found = ENCODE_FILE (file_found);
+      if (fd == -2)
+       {
+         /* The file exists locally, but has a file handler.  (This
+            happens, e.g., under Auto Image File Mode.)  'openp'
+            didn't open the file, so we should, because the caller
+            expects that.  */
+         fd = emacs_open (SSDATA (file_found), O_RDONLY | O_BINARY, 0);
+       }
+    }
+  else /* fd < 0, but not -2 */
     return Qnil;
   if (pfd)
     *pfd = fd;