diff options
Diffstat (limited to 'src/fileio.c')
| -rw-r--r-- | src/fileio.c | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/src/fileio.c b/src/fileio.c index a80ba11bcab..c62d5724eff 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -53,12 +53,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 53 | #include <ctype.h> | 53 | #include <ctype.h> |
| 54 | #include <errno.h> | 54 | #include <errno.h> |
| 55 | 55 | ||
| 56 | #ifndef vax11c | ||
| 57 | #ifndef USE_CRT_DLL | ||
| 58 | extern int errno; | ||
| 59 | #endif | ||
| 60 | #endif | ||
| 61 | |||
| 62 | #include "lisp.h" | 56 | #include "lisp.h" |
| 63 | #include "intervals.h" | 57 | #include "intervals.h" |
| 64 | #include "buffer.h" | 58 | #include "buffer.h" |
| @@ -79,11 +73,9 @@ extern int errno; | |||
| 79 | #ifdef MSDOS | 73 | #ifdef MSDOS |
| 80 | #include "msdos.h" | 74 | #include "msdos.h" |
| 81 | #include <sys/param.h> | 75 | #include <sys/param.h> |
| 82 | #if __DJGPP__ >= 2 | ||
| 83 | #include <fcntl.h> | 76 | #include <fcntl.h> |
| 84 | #include <string.h> | 77 | #include <string.h> |
| 85 | #endif | 78 | #endif |
| 86 | #endif | ||
| 87 | 79 | ||
| 88 | #ifdef DOS_NT | 80 | #ifdef DOS_NT |
| 89 | #define CORRECT_DIR_SEPS(s) \ | 81 | #define CORRECT_DIR_SEPS(s) \ |
| @@ -2012,7 +2004,6 @@ uid and gid of FILE to NEWNAME. */) | |||
| 2012 | copyable by us. */ | 2004 | copyable by us. */ |
| 2013 | input_file_statable_p = (fstat (ifd, &st) >= 0); | 2005 | input_file_statable_p = (fstat (ifd, &st) >= 0); |
| 2014 | 2006 | ||
| 2015 | #if !defined (MSDOS) || __DJGPP__ > 1 | ||
| 2016 | if (out_st.st_mode != 0 | 2007 | if (out_st.st_mode != 0 |
| 2017 | && st.st_dev == out_st.st_dev && st.st_ino == out_st.st_ino) | 2008 | && st.st_dev == out_st.st_dev && st.st_ino == out_st.st_ino) |
| 2018 | { | 2009 | { |
| @@ -2020,7 +2011,6 @@ uid and gid of FILE to NEWNAME. */) | |||
| 2020 | report_file_error ("Input and output files are the same", | 2011 | report_file_error ("Input and output files are the same", |
| 2021 | Fcons (file, Fcons (newname, Qnil))); | 2012 | Fcons (file, Fcons (newname, Qnil))); |
| 2022 | } | 2013 | } |
| 2023 | #endif | ||
| 2024 | 2014 | ||
| 2025 | #if defined (S_ISREG) && defined (S_ISLNK) | 2015 | #if defined (S_ISREG) && defined (S_ISLNK) |
| 2026 | if (input_file_statable_p) | 2016 | if (input_file_statable_p) |
| @@ -2091,7 +2081,7 @@ uid and gid of FILE to NEWNAME. */) | |||
| 2091 | 2081 | ||
| 2092 | emacs_close (ifd); | 2082 | emacs_close (ifd); |
| 2093 | 2083 | ||
| 2094 | #if defined (__DJGPP__) && __DJGPP__ > 1 | 2084 | #ifdef MSDOS |
| 2095 | if (input_file_statable_p) | 2085 | if (input_file_statable_p) |
| 2096 | { | 2086 | { |
| 2097 | /* In DJGPP v2.0 and later, fstat usually returns true file mode bits, | 2087 | /* In DJGPP v2.0 and later, fstat usually returns true file mode bits, |
| @@ -2101,7 +2091,7 @@ uid and gid of FILE to NEWNAME. */) | |||
| 2101 | if ((_djstat_flags & _STFAIL_WRITEBIT) == 0) | 2091 | if ((_djstat_flags & _STFAIL_WRITEBIT) == 0) |
| 2102 | chmod (SDATA (encoded_newname), st.st_mode & 07777); | 2092 | chmod (SDATA (encoded_newname), st.st_mode & 07777); |
| 2103 | } | 2093 | } |
| 2104 | #endif /* DJGPP version 2 or newer */ | 2094 | #endif /* MSDOS */ |
| 2105 | #endif /* not WINDOWSNT */ | 2095 | #endif /* not WINDOWSNT */ |
| 2106 | 2096 | ||
| 2107 | /* Discard the unwind protects. */ | 2097 | /* Discard the unwind protects. */ |
| @@ -2477,16 +2467,7 @@ check_executable (filename) | |||
| 2477 | struct stat st; | 2467 | struct stat st; |
| 2478 | if (stat (filename, &st) < 0) | 2468 | if (stat (filename, &st) < 0) |
| 2479 | return 0; | 2469 | return 0; |
| 2480 | #if defined (WINDOWSNT) || (defined (MSDOS) && __DJGPP__ > 1) | ||
| 2481 | return ((st.st_mode & S_IEXEC) != 0); | 2470 | return ((st.st_mode & S_IEXEC) != 0); |
| 2482 | #else | ||
| 2483 | return (S_ISREG (st.st_mode) | ||
| 2484 | && len >= 5 | ||
| 2485 | && (xstrcasecmp ((suffix = filename + len-4), ".com") == 0 | ||
| 2486 | || xstrcasecmp (suffix, ".exe") == 0 | ||
| 2487 | || xstrcasecmp (suffix, ".bat") == 0) | ||
| 2488 | || (st.st_mode & S_IFMT) == S_IFDIR); | ||
| 2489 | #endif /* not WINDOWSNT */ | ||
| 2490 | #else /* not DOS_NT */ | 2471 | #else /* not DOS_NT */ |
| 2491 | #ifdef HAVE_EUIDACCESS | 2472 | #ifdef HAVE_EUIDACCESS |
| 2492 | return (euidaccess (filename, 1) >= 0); | 2473 | return (euidaccess (filename, 1) >= 0); |
| @@ -2885,10 +2866,6 @@ Return nil, if file does not exist or is not accessible. */) | |||
| 2885 | 2866 | ||
| 2886 | if (stat (SDATA (absname), &st) < 0) | 2867 | if (stat (SDATA (absname), &st) < 0) |
| 2887 | return Qnil; | 2868 | return Qnil; |
| 2888 | #if defined (MSDOS) && __DJGPP__ < 2 | ||
| 2889 | if (check_executable (SDATA (absname))) | ||
| 2890 | st.st_mode |= S_IEXEC; | ||
| 2891 | #endif /* MSDOS && __DJGPP__ < 2 */ | ||
| 2892 | 2869 | ||
| 2893 | return make_number (st.st_mode & 07777); | 2870 | return make_number (st.st_mode & 07777); |
| 2894 | } | 2871 | } |