]> code.delx.au - gnu-emacs/commitdiff
* fileio.c (barf_or_query_if_file_exists): Use S_ISDIR.
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 4 Jul 2011 17:50:12 +0000 (10:50 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 4 Jul 2011 17:50:12 +0000 (10:50 -0700)
This is more efficient than Ffile_directory_p and avoids a minor race.

src/ChangeLog
src/fileio.c

index 70f6fb7469fe0a152f72fbbcbf9dda73a04a0a92..8e208565bde74bcd313e7bb1668bff67a56a754e 100644 (file)
@@ -1,3 +1,8 @@
+2011-07-04  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * fileio.c (barf_or_query_if_file_exists): Use S_ISDIR.
+       This is more efficient than Ffile_directory_p and avoids a minor race.
+
 2011-07-04  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * buffer.c (Foverlay_put): Say what the return value is
index 68834d5b5ecd5fe75ae85d0effe0105fa7fcc56b..c6f8dfe4683e12bb705bfaca39cab1996c6cb032 100644 (file)
@@ -1755,7 +1755,7 @@ barf_or_query_if_file_exists (Lisp_Object absname, const char *querystring,
      regardless of what access permissions it has.  */
   if (lstat (SSDATA (encoded_filename), &statbuf) >= 0)
     {
-      if (Ffile_directory_p (absname))
+      if (S_ISDIR (statbuf.st_mode))
        xsignal2 (Qfile_error,
                  build_string ("File is a directory"), absname);