diff options
author | Richard M. Stallman <rms@gnu.org> | 1995-11-14 17:38:19 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1995-11-14 17:38:19 +0000 |
commit | 405ed8b0307d94fd5a07f9c6d0579a09ad55f211 (patch) | |
tree | bb89baf857bad4db188d459a0ac3f5686cb2cda7 /src/fileio.c | |
parent | 51b6409a22ef312935d91f451f7d57ef831cdb12 (diff) | |
download | emacs-405ed8b0307d94fd5a07f9c6d0579a09ad55f211.tar.gz |
(check_executable) [DOS_NT]: Treat all dirs as executable.
(Fcopy_file): Don't chmod output file on MSDOS
unless we have DJGPP version 2.
Diffstat (limited to 'src/fileio.c')
-rw-r--r-- | src/fileio.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/fileio.c b/src/fileio.c index 47b987ad784..fab5e9dfb46 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -1949,7 +1949,18 @@ A prefix arg makes KEEP-TIME non-nil.") if (set_file_times (XSTRING (newname)->data, atime, mtime)) report_file_error ("I/O error", Fcons (newname, Qnil)); } +#ifndef MSDOS + chmod (XSTRING (newname)->data, st.st_mode & 07777); +#else /* MSDOS */ +#if defined (__DJGPP__) && __DJGPP__ > 1 + /* In DJGPP v2.0 and later, fstat usually returns true file mode bits, + and if it can't, it tells so. Otherwise, under MSDOS we usually + get only the READ bit, which will make the copied file read-only, + so it's better not to chmod at all. */ + if ((_djstat_flags & _STFAIL_WRITEBIT) == 0) chmod (XSTRING (newname)->data, st.st_mode & 07777); +#endif /* DJGPP version 2 or newer */ +#endif /* MSDOS */ } close (ifd); @@ -2347,7 +2358,8 @@ check_executable (filename) && len >= 5 && (stricmp ((suffix = filename + len-4), ".com") == 0 || stricmp (suffix, ".exe") == 0 - || stricmp (suffix, ".bat") == 0)); + || stricmp (suffix, ".bat") == 0) + || (st.st_mode & S_IFMT) == S_IFDIR); #else /* not DOS_NT */ #ifdef HAVE_EACCESS return (eaccess (filename, 1) >= 0); |