changeset 8703:aaa0730f8b1e

(Ffile_accessible_directory_p): Put back the gcpro.
author Karl Heuer <kwzh@gnu.org>
date Mon, 05 Sep 1994 01:12:25 +0000
parents 097fe97274e9
children ec7ec0e35e5e
files src/fileio.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/fileio.c	Mon Sep 05 00:13:01 1994 +0000
+++ b/src/fileio.c	Mon Sep 05 01:12:25 1994 +0000
@@ -2383,6 +2383,7 @@
 {
   Lisp_Object handler;
   int tem;
+  struct gcpro gcpro1;
 
   /* If the file name has special constructs in it,
      call the corresponding file handler.  */
@@ -2390,10 +2391,16 @@
   if (!NILP (handler))
     return call2 (handler, Qfile_accessible_directory_p, filename);
 
-  /* Need to gcpro in case the first function call has a handler that
-     causes filename to be relocated.  */
+  /* It's an unlikely combination, but yes we really do need to gcpro:
+     Suppose that file-accessible-directory-p has no handler, but
+     file-directory-p does have a handler; this handler causes a GC which
+     relocates the string in `filename'; and finally file-directory-p
+     returns non-nil.  Then we would end up passing a garbaged string
+     to file-executable-p.  */
+  GCPRO1 (filename);
   tem = (NILP (Ffile_directory_p (filename))
 	 || NILP (Ffile_executable_p (filename)));
+  UNGCPRO;
   return tem ? Qnil : Qt;
 }