summaryrefslogtreecommitdiff
path: root/src/dired.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-02-21 17:55:20 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2011-02-21 17:55:20 -0800
commitf68c809d7e91fcde5ee2e4f7f15def3d7e48b720 (patch)
tree9df8577ff5f281f066f778dee44bdb839eb13daf /src/dired.c
parent5ecec6a7f4a1ce83abd53a14fba7f51b668c6336 (diff)
downloademacs-f68c809d7e91fcde5ee2e4f7f15def3d7e48b720.tar.gz
[ChangeLog]
Assume S_ISLNK etc. work, since gnulib supports this. * Makefile.in (GNULIB_MODULES): Add sys_stat. * configure.in: Check for lstat and set HAVE_LSTAT=0 if not. Pretend to be using the gnulib lstat module for benefit of sys/stat.h. * configure, lib/Makefile.in, lib/gnulib.mk: Regenerate. [lib-src/ChangeLog] Assume S_ISLNK etc. work, since gnulib supports this. * etags.c (S_ISREG): Remove. [src/ChangeLog] Assume S_ISLNK etc. work, since gnulib supports this. * config.in: Regenerate. * dired.c (lstat): Remove. (file_name_completion): Assume S_ISDIR works. (file_name_completion_stat): Assume S_ISLNK works. Do not bother calling stat unless lstat says it's a symlink. * fileio.c (S_ISLNK, S_ISFIFO, S_ISREG, lstat): Remove. (Fcopy_file): Assume S_ISREG and S_ISLNK work. (check_writable, Ffile_writable_p, Fset_file_times): Assume S_ISDIR works. (Ffile_readable_p): Use S_IFIFO, not S_ISFIFO, to guess whether fifos exist. (Ffile_regular_p, Finsert_file_contents): Assumes S_ISREG works. * filelock.c (S_ISLNK): Remove. * lread.c (openp): Assume S_ISDIR works. * xrdb.c (S_ISDIR): Remove.
Diffstat (limited to 'src/dired.c')
-rw-r--r--src/dired.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/dired.c b/src/dired.c
index b01ce8d4d8f..92c12846558 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -84,13 +84,6 @@ extern struct re_pattern_buffer *compile_pattern (Lisp_Object,
struct re_registers *,
Lisp_Object, int, int);
-/* if system does not have symbolic links, it does not have lstat.
- In that case, use ordinary stat instead. */
-
-#ifndef S_IFLNK
-#define lstat stat
-#endif
-
Lisp_Object Qdirectory_files;
Lisp_Object Qdirectory_files_and_attributes;
Lisp_Object Qfile_name_completion;
@@ -539,7 +532,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v
if (file_name_completion_stat (encoded_dir, dp, &st) < 0)
continue;
- directoryp = ((st.st_mode & S_IFMT) == S_IFDIR);
+ directoryp = S_ISDIR (st.st_mode);
tem = Qnil;
/* If all_flag is set, always include all.
It would not actually be helpful to the user to ignore any possible
@@ -843,20 +836,16 @@ file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_ad
memcpy (fullname + pos, dp->d_name, len);
fullname[pos + len] = 0;
-#ifdef S_IFLNK
/* We want to return success if a link points to a nonexistent file,
but we want to return the status for what the link points to,
in case it is a directory. */
value = lstat (fullname, st_addr);
- stat (fullname, st_addr);
- return value;
-#else
- value = stat (fullname, st_addr);
+ if (value == 0 && S_ISLNK (st_addr->st_mode))
+ stat (fullname, st_addr);
#ifdef MSDOS
_djstat_flags = save_djstat_flags;
#endif /* MSDOS */
return value;
-#endif /* S_IFLNK */
}
Lisp_Object