aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--Makefile.in2
-rwxr-xr-xconfigure18
-rw-r--r--configure.in9
-rw-r--r--lib-src/ChangeLog5
-rw-r--r--lib-src/etags.c8
-rw-r--r--lib/Makefile.in2
-rw-r--r--lib/gnulib.mk2
-rw-r--r--src/ChangeLog19
-rw-r--r--src/config.in3
-rw-r--r--src/dired.c17
-rw-r--r--src/fileio.c35
-rw-r--r--src/filelock.c4
-rw-r--r--src/lread.c5
-rw-r--r--src/xrdb.c5
15 files changed, 79 insertions, 63 deletions
diff --git a/ChangeLog b/ChangeLog
index cfd77b652b4..5aacf77688b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
12011-02-22 Paul Eggert <eggert@cs.ucla.edu>
2
3 Assume S_ISLNK etc. work, since gnulib supports this.
4 * Makefile.in (GNULIB_MODULES): Add sys_stat.
5 * configure.in: Check for lstat and set HAVE_LSTAT=0 if not.
6 Pretend to be using the gnulib lstat module for benefit of sys/stat.h.
7 * configure, lib/Makefile.in, lib/gnulib.mk: Regenerate.
8
12011-02-21 Paul Eggert <eggert@cs.ucla.edu> 92011-02-21 Paul Eggert <eggert@cs.ucla.edu>
2 10
3 * lib/min-max.h: New file, for "min" and "max". 11 * lib/min-max.h: New file, for "min" and "max".
diff --git a/Makefile.in b/Makefile.in
index b1861241882..489409afe5b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -332,7 +332,7 @@ DOS_gnulib_comp.m4 = gl-comp.m4
332# as per $(gnulib_srcdir)/DEPENDENCIES. 332# as per $(gnulib_srcdir)/DEPENDENCIES.
333GNULIB_MODULES = \ 333GNULIB_MODULES = \
334 crypto/md5 dtoastr filemode getloadavg getopt-gnu \ 334 crypto/md5 dtoastr filemode getloadavg getopt-gnu \
335 ignore-value mktime strftime 335 ignore-value mktime strftime sys_stat
336GNULIB_TOOL_FLAGS = \ 336GNULIB_TOOL_FLAGS = \
337 --import --no-changelog --no-vc-files --makefile-name=gnulib.mk 337 --import --no-changelog --no-vc-files --makefile-name=gnulib.mk
338sync-from-gnulib: $(gnulib_srcdir) 338sync-from-gnulib: $(gnulib_srcdir)
diff --git a/configure b/configure
index 16673f2ca79..70aa60bb1e7 100755
--- a/configure
+++ b/configure
@@ -2963,6 +2963,7 @@ as_fn_append ac_func_list " tzset"
2963as_fn_append ac_header_list " sys/stat.h" 2963as_fn_append ac_header_list " sys/stat.h"
2964as_fn_append ac_header_list " sys/time.h" 2964as_fn_append ac_header_list " sys/time.h"
2965as_fn_append ac_func_list " localtime_r" 2965as_fn_append ac_func_list " localtime_r"
2966as_fn_append ac_func_list " lstat"
2966# Check that the precious variables saved in the cache have kept the same 2967# Check that the precious variables saved in the cache have kept the same
2967# value. 2968# value.
2968ac_cache_corrupted=false 2969ac_cache_corrupted=false
@@ -17211,6 +17212,23 @@ $as_echo "$gl_cv_next_unistd_h" >&6; }
17211 17212
17212 17213
17213 17214
17215# Emacs does not care about lstat's behavior on files whose names end in
17216# trailing slashes, so it does not use the gnulib lstat module.
17217# However, Emacs does want the "#define lstat stat" in sys/stat.h
17218# when lstat does not exist, so it pretends to use the lstat module
17219# even though it implements only the lstat-checking part of that module.
17220
17221
17222
17223test $ac_cv_func_lstat = yes || HAVE_LSTAT=0
17224
17225
17226
17227 GNULIB_LSTAT=1
17228
17229
17230
17231
17214# UNIX98 PTYs. 17232# UNIX98 PTYs.
17215for ac_func in grantpt 17233for ac_func in grantpt
17216do : 17234do :
diff --git a/configure.in b/configure.in
index 376c82c4ca4..fa5ae960c59 100644
--- a/configure.in
+++ b/configure.in
@@ -2661,6 +2661,15 @@ gl_ASSERT_NO_GNULIB_POSIXCHECK
2661gl_ASSERT_NO_GNULIB_TESTS 2661gl_ASSERT_NO_GNULIB_TESTS
2662gl_INIT 2662gl_INIT
2663 2663
2664# Emacs does not care about lstat's behavior on files whose names end in
2665# trailing slashes, so it does not use the gnulib lstat module.
2666# However, Emacs does want the "#define lstat stat" in sys/stat.h
2667# when lstat does not exist, so it pretends to use the lstat module
2668# even though it implements only the lstat-checking part of that module.
2669AC_CHECK_FUNCS_ONCE([lstat])
2670test $ac_cv_func_lstat = yes || HAVE_LSTAT=0
2671gl_SYS_STAT_MODULE_INDICATOR([lstat])
2672
2664# UNIX98 PTYs. 2673# UNIX98 PTYs.
2665AC_CHECK_FUNCS(grantpt) 2674AC_CHECK_FUNCS(grantpt)
2666 2675
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 7aa13a45cba..6d50f4fa4fc 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,8 @@
12011-02-22 Paul Eggert <eggert@cs.ucla.edu>
2
3 Assume S_ISLNK etc. work, since gnulib supports this.
4 * etags.c (S_ISREG): Remove.
5
12011-02-21 Paul Eggert <eggert@cs.ucla.edu> 62011-02-21 Paul Eggert <eggert@cs.ucla.edu>
2 7
3 New file "lib/min-max.h". 8 New file "lib/min-max.h".
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 9471c0fe29f..9ca10776259 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -190,10 +190,6 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
190# define assert(x) ((void) 0) 190# define assert(x) ((void) 0)
191#endif 191#endif
192 192
193#if !defined (S_ISREG) && defined (S_IFREG)
194# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
195#endif
196
197#ifdef NO_LONG_OPTIONS /* define this if you don't have GNU getopt */ 193#ifdef NO_LONG_OPTIONS /* define this if you don't have GNU getopt */
198# define NO_LONG_OPTIONS TRUE 194# define NO_LONG_OPTIONS TRUE
199# define getopt_long(argc,argv,optstr,lopts,lind) getopt (argc, argv, optstr) 195# define getopt_long(argc,argv,optstr,lopts,lind) getopt (argc, argv, optstr)
@@ -5327,7 +5323,7 @@ prolog_skip_comment (linebuffer *plb, FILE *inf)
5327 */ 5323 */
5328static int 5324static int
5329prolog_pr (char *s, char *last) 5325prolog_pr (char *s, char *last)
5330 5326
5331 /* Name of last clause. */ 5327 /* Name of last clause. */
5332{ 5328{
5333 int pos; 5329 int pos;
@@ -5484,7 +5480,7 @@ Erlang_functions (FILE *inf)
5484 */ 5480 */
5485static int 5481static int
5486erlang_func (char *s, char *last) 5482erlang_func (char *s, char *last)
5487 5483
5488 /* Name of last clause. */ 5484 /* Name of last clause. */
5489{ 5485{
5490 int pos; 5486 int pos;
diff --git a/lib/Makefile.in b/lib/Makefile.in
index b16587bbddc..48e7b1d6507 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -24,7 +24,7 @@
24# the same distribution terms as the rest of that program. 24# the same distribution terms as the rest of that program.
25# 25#
26# Generated by gnulib-tool. 26# Generated by gnulib-tool.
27# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value mktime strftime 27# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value mktime strftime sys_stat
28 28
29VPATH = @srcdir@ 29VPATH = @srcdir@
30pkgdatadir = $(datadir)/@PACKAGE@ 30pkgdatadir = $(datadir)/@PACKAGE@
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index bdba2e9c1bb..32bf5714d17 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -9,7 +9,7 @@
9# the same distribution terms as the rest of that program. 9# the same distribution terms as the rest of that program.
10# 10#
11# Generated by gnulib-tool. 11# Generated by gnulib-tool.
12# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value mktime strftime 12# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value mktime strftime sys_stat
13 13
14 14
15MOSTLYCLEANFILES += core *.stackdump 15MOSTLYCLEANFILES += core *.stackdump
diff --git a/src/ChangeLog b/src/ChangeLog
index 9713a4a6ed5..d0208d507b5 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,22 @@
12011-02-22 Paul Eggert <eggert@cs.ucla.edu>
2
3 Assume S_ISLNK etc. work, since gnulib supports this.
4 * config.in: Regenerate.
5 * dired.c (lstat): Remove.
6 (file_name_completion): Assume S_ISDIR works.
7 (file_name_completion_stat): Assume S_ISLNK works.
8 Do not bother calling stat unless lstat says it's a symlink.
9 * fileio.c (S_ISLNK, S_ISFIFO, S_ISREG, lstat): Remove.
10 (Fcopy_file): Assume S_ISREG and S_ISLNK work.
11 (check_writable, Ffile_writable_p, Fset_file_times):
12 Assume S_ISDIR works.
13 (Ffile_readable_p): Use S_IFIFO, not S_ISFIFO, to guess whether
14 fifos exist.
15 (Ffile_regular_p, Finsert_file_contents): Assumes S_ISREG works.
16 * filelock.c (S_ISLNK): Remove.
17 * lread.c (openp): Assume S_ISDIR works.
18 * xrdb.c (S_ISDIR): Remove.
19
12011-02-21 Eli Zaretskii <eliz@gnu.org> 202011-02-21 Eli Zaretskii <eliz@gnu.org>
2 21
3 * makefile.w32-in ($(BLD)/filemode.$(O)): Move recipe to 22 * makefile.w32-in ($(BLD)/filemode.$(O)): Move recipe to
diff --git a/src/config.in b/src/config.in
index 9c23fb583fa..ded8c6b292a 100644
--- a/src/config.in
+++ b/src/config.in
@@ -465,6 +465,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
465/* Define to 1 if you have the `lrand48' function. */ 465/* Define to 1 if you have the `lrand48' function. */
466#undef HAVE_LRAND48 466#undef HAVE_LRAND48
467 467
468/* Define to 1 if you have the `lstat' function. */
469#undef HAVE_LSTAT
470
468/* Define to 1 if using libm17n-flt. */ 471/* Define to 1 if using libm17n-flt. */
469#undef HAVE_M17N_FLT 472#undef HAVE_M17N_FLT
470 473
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,
84 struct re_registers *, 84 struct re_registers *,
85 Lisp_Object, int, int); 85 Lisp_Object, int, int);
86 86
87/* if system does not have symbolic links, it does not have lstat.
88 In that case, use ordinary stat instead. */
89
90#ifndef S_IFLNK
91#define lstat stat
92#endif
93
94Lisp_Object Qdirectory_files; 87Lisp_Object Qdirectory_files;
95Lisp_Object Qdirectory_files_and_attributes; 88Lisp_Object Qdirectory_files_and_attributes;
96Lisp_Object Qfile_name_completion; 89Lisp_Object Qfile_name_completion;
@@ -539,7 +532,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v
539 if (file_name_completion_stat (encoded_dir, dp, &st) < 0) 532 if (file_name_completion_stat (encoded_dir, dp, &st) < 0)
540 continue; 533 continue;
541 534
542 directoryp = ((st.st_mode & S_IFMT) == S_IFDIR); 535 directoryp = S_ISDIR (st.st_mode);
543 tem = Qnil; 536 tem = Qnil;
544 /* If all_flag is set, always include all. 537 /* If all_flag is set, always include all.
545 It would not actually be helpful to the user to ignore any possible 538 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
843 memcpy (fullname + pos, dp->d_name, len); 836 memcpy (fullname + pos, dp->d_name, len);
844 fullname[pos + len] = 0; 837 fullname[pos + len] = 0;
845 838
846#ifdef S_IFLNK
847 /* We want to return success if a link points to a nonexistent file, 839 /* We want to return success if a link points to a nonexistent file,
848 but we want to return the status for what the link points to, 840 but we want to return the status for what the link points to,
849 in case it is a directory. */ 841 in case it is a directory. */
850 value = lstat (fullname, st_addr); 842 value = lstat (fullname, st_addr);
851 stat (fullname, st_addr); 843 if (value == 0 && S_ISLNK (st_addr->st_mode))
852 return value; 844 stat (fullname, st_addr);
853#else
854 value = stat (fullname, st_addr);
855#ifdef MSDOS 845#ifdef MSDOS
856 _djstat_flags = save_djstat_flags; 846 _djstat_flags = save_djstat_flags;
857#endif /* MSDOS */ 847#endif /* MSDOS */
858 return value; 848 return value;
859#endif /* S_IFLNK */
860} 849}
861 850
862Lisp_Object 851Lisp_Object
diff --git a/src/fileio.c b/src/fileio.c
index 2ccad83f668..0225e0bf3a9 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -26,18 +26,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
26#include <setjmp.h> 26#include <setjmp.h>
27#include <unistd.h> 27#include <unistd.h>
28 28
29#if !defined (S_ISLNK) && defined (S_IFLNK)
30# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
31#endif
32
33#if !defined (S_ISFIFO) && defined (S_IFIFO)
34# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
35#endif
36
37#if !defined (S_ISREG) && defined (S_IFREG)
38# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
39#endif
40
41#ifdef HAVE_PWD_H 29#ifdef HAVE_PWD_H
42#include <pwd.h> 30#include <pwd.h>
43#endif 31#endif
@@ -95,10 +83,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
95 83
96#include "commands.h" 84#include "commands.h"
97 85
98#ifndef S_ISLNK
99# define lstat stat
100#endif
101
102#ifndef FILE_SYSTEM_CASE 86#ifndef FILE_SYSTEM_CASE
103#define FILE_SYSTEM_CASE(filename) (filename) 87#define FILE_SYSTEM_CASE(filename) (filename)
104#endif 88#endif
@@ -1922,7 +1906,6 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */)
1922 Fcons (file, Fcons (newname, Qnil))); 1906 Fcons (file, Fcons (newname, Qnil)));
1923 } 1907 }
1924 1908
1925#if defined (S_ISREG) && defined (S_ISLNK)
1926 if (input_file_statable_p) 1909 if (input_file_statable_p)
1927 { 1910 {
1928 if (!(S_ISREG (st.st_mode)) && !(S_ISLNK (st.st_mode))) 1911 if (!(S_ISREG (st.st_mode)) && !(S_ISLNK (st.st_mode)))
@@ -1934,7 +1917,6 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */)
1934 report_file_error ("Non-regular file", Fcons (file, Qnil)); 1917 report_file_error ("Non-regular file", Fcons (file, Qnil));
1935 } 1918 }
1936 } 1919 }
1937#endif /* S_ISREG && S_ISLNK */
1938 1920
1939#ifdef MSDOS 1921#ifdef MSDOS
1940 /* System's default file type was set to binary by _fmode in emacs.c. */ 1922 /* System's default file type was set to binary by _fmode in emacs.c. */
@@ -2408,7 +2390,7 @@ check_writable (const char *filename)
2408 struct stat st; 2390 struct stat st;
2409 if (stat (filename, &st) < 0) 2391 if (stat (filename, &st) < 0)
2410 return 0; 2392 return 0;
2411 return (st.st_mode & S_IWRITE || (st.st_mode & S_IFMT) == S_IFDIR); 2393 return (st.st_mode & S_IWRITE || S_ISDIR (st.st_mode));
2412#else /* not MSDOS */ 2394#else /* not MSDOS */
2413#ifdef HAVE_EUIDACCESS 2395#ifdef HAVE_EUIDACCESS
2414 return (euidaccess (filename, 2) >= 0); 2396 return (euidaccess (filename, 2) >= 0);
@@ -2500,7 +2482,7 @@ See also `file-exists-p' and `file-attributes'. */)
2500 return Qnil; 2482 return Qnil;
2501#else /* not DOS_NT and not macintosh */ 2483#else /* not DOS_NT and not macintosh */
2502 flags = O_RDONLY; 2484 flags = O_RDONLY;
2503#if defined (S_ISFIFO) && defined (O_NONBLOCK) 2485#if defined (S_IFIFO) && defined (O_NONBLOCK)
2504 /* Opening a fifo without O_NONBLOCK can wait. 2486 /* Opening a fifo without O_NONBLOCK can wait.
2505 We don't want to wait. But we don't want to mess wth O_NONBLOCK 2487 We don't want to wait. But we don't want to mess wth O_NONBLOCK
2506 except in the case of a fifo, on a system which handles it. */ 2488 except in the case of a fifo, on a system which handles it. */
@@ -2555,7 +2537,7 @@ DEFUN ("file-writable-p", Ffile_writable_p, Sfile_writable_p, 1, 1, 0,
2555 should check ACLs though, which do affect this. */ 2537 should check ACLs though, which do affect this. */
2556 if (stat (SDATA (dir), &statbuf) < 0) 2538 if (stat (SDATA (dir), &statbuf) < 0)
2557 return Qnil; 2539 return Qnil;
2558 return (statbuf.st_mode & S_IFMT) == S_IFDIR ? Qt : Qnil; 2540 return S_ISDIR (statbuf.st_mode) ? Qt : Qnil;
2559#else 2541#else
2560 return (check_writable (!NILP (dir) ? SSDATA (dir) : "") 2542 return (check_writable (!NILP (dir) ? SSDATA (dir) : "")
2561 ? Qt : Qnil); 2543 ? Qt : Qnil);
@@ -2681,7 +2663,7 @@ See `file-symlink-p' to distinguish symlinks. */)
2681 2663
2682 if (stat (SSDATA (absname), &st) < 0) 2664 if (stat (SSDATA (absname), &st) < 0)
2683 return Qnil; 2665 return Qnil;
2684 return (st.st_mode & S_IFMT) == S_IFDIR ? Qt : Qnil; 2666 return S_ISDIR (st.st_mode) ? Qt : Qnil;
2685} 2667}
2686 2668
2687DEFUN ("file-accessible-directory-p", Ffile_accessible_directory_p, Sfile_accessible_directory_p, 1, 1, 0, 2669DEFUN ("file-accessible-directory-p", Ffile_accessible_directory_p, Sfile_accessible_directory_p, 1, 1, 0,
@@ -2744,12 +2726,12 @@ See `file-symlink-p' to distinguish symlinks. */)
2744 2726
2745 if (result < 0) 2727 if (result < 0)
2746 return Qnil; 2728 return Qnil;
2747 return (st.st_mode & S_IFMT) == S_IFREG ? Qt : Qnil; 2729 return S_ISREG (st.st_mode) ? Qt : Qnil;
2748 } 2730 }
2749#else 2731#else
2750 if (stat (SSDATA (absname), &st) < 0) 2732 if (stat (SSDATA (absname), &st) < 0)
2751 return Qnil; 2733 return Qnil;
2752 return (st.st_mode & S_IFMT) == S_IFREG ? Qt : Qnil; 2734 return S_ISREG (st.st_mode) ? Qt : Qnil;
2753#endif 2735#endif
2754} 2736}
2755 2737
@@ -3007,8 +2989,7 @@ Use the current time if TIME is nil. TIME is in the format of
3007 struct stat st; 2989 struct stat st;
3008 2990
3009 /* Setting times on a directory always fails. */ 2991 /* Setting times on a directory always fails. */
3010 if (stat (SDATA (encoded_absname), &st) == 0 2992 if (stat (SSDATA (encoded_absname), &st) == 0 && S_ISDIR (st.st_mode))
3011 && (st.st_mode & S_IFMT) == S_IFDIR)
3012 return Qnil; 2993 return Qnil;
3013#endif 2994#endif
3014 report_file_error ("Setting file times", Fcons (absname, Qnil)); 2995 report_file_error ("Setting file times", Fcons (absname, Qnil));
@@ -3267,7 +3248,6 @@ variable `last-coding-system-used' to the coding system actually used. */)
3267 goto notfound; 3248 goto notfound;
3268 } 3249 }
3269 3250
3270#ifdef S_IFREG
3271 /* This code will need to be changed in order to work on named 3251 /* This code will need to be changed in order to work on named
3272 pipes, and it's probably just not worth it. So we should at 3252 pipes, and it's probably just not worth it. So we should at
3273 least signal an error. */ 3253 least signal an error. */
@@ -3282,7 +3262,6 @@ variable `last-coding-system-used' to the coding system actually used. */)
3282 xsignal2 (Qfile_error, 3262 xsignal2 (Qfile_error,
3283 build_string ("not a regular file"), orig_filename); 3263 build_string ("not a regular file"), orig_filename);
3284 } 3264 }
3285#endif
3286 3265
3287 if (fd < 0) 3266 if (fd < 0)
3288 if ((fd = emacs_open (SSDATA (filename), O_RDONLY, 0)) < 0) 3267 if ((fd = emacs_open (SSDATA (filename), O_RDONLY, 0)) < 0)
diff --git a/src/filelock.c b/src/filelock.c
index 8e18bb7b650..7f8f0e1c0fb 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -51,10 +51,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
51#include <utmp.h> 51#include <utmp.h>
52#endif 52#endif
53 53
54#if !defined (S_ISLNK) && defined (S_IFLNK)
55#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
56#endif
57
58/* A file whose last-modified time is just after the most recent boot. 54/* A file whose last-modified time is just after the most recent boot.
59 Define this to be NULL to disable checking for this file. */ 55 Define this to be NULL to disable checking for this file. */
60#ifndef BOOT_TIME_FILE 56#ifndef BOOT_TIME_FILE
diff --git a/src/lread.c b/src/lread.c
index 855869cd90d..e594a363873 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1402,8 +1402,7 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *sto
1402 1402
1403 encoded_fn = ENCODE_FILE (string); 1403 encoded_fn = ENCODE_FILE (string);
1404 pfn = SSDATA (encoded_fn); 1404 pfn = SSDATA (encoded_fn);
1405 exists = (stat (pfn, &st) >= 0 1405 exists = (stat (pfn, &st) == 0 && ! S_ISDIR (st.st_mode));
1406 && (st.st_mode & S_IFMT) != S_IFDIR);
1407 if (exists) 1406 if (exists)
1408 { 1407 {
1409 /* Check that we can access or open it. */ 1408 /* Check that we can access or open it. */
@@ -4385,7 +4384,7 @@ to load. See also `load-dangerous-libraries'. */);
4385 4384
4386 Qdir_ok = intern_c_string ("dir-ok"); 4385 Qdir_ok = intern_c_string ("dir-ok");
4387 staticpro (&Qdir_ok); 4386 staticpro (&Qdir_ok);
4388 4387
4389 Qdo_after_load_evaluation = intern_c_string ("do-after-load-evaluation"); 4388 Qdo_after_load_evaluation = intern_c_string ("do-after-load-evaluation");
4390 staticpro (&Qdo_after_load_evaluation) ; 4389 staticpro (&Qdo_after_load_evaluation) ;
4391 4390
diff --git a/src/xrdb.c b/src/xrdb.c
index 01714900752..9fb3f3474fb 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -38,10 +38,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
38#endif 38#endif
39#include <sys/stat.h> 39#include <sys/stat.h>
40 40
41#if !defined(S_ISDIR) && defined(S_IFDIR)
42#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
43#endif
44
45#include "lisp.h" 41#include "lisp.h"
46 42
47#ifdef USE_MOTIF 43#ifdef USE_MOTIF
@@ -764,4 +760,3 @@ main (argc, argv)
764 XCloseDisplay (display); 760 XCloseDisplay (display);
765} 761}
766#endif /* TESTRM */ 762#endif /* TESTRM */
767