aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1995-11-14 17:38:19 +0000
committerRichard M. Stallman1995-11-14 17:38:19 +0000
commit2dc3be7eba48b17a9eb8f02783e49999307491d0 (patch)
tree44fd191e39e9a6ac1497552d02486177ec9bd358 /src
parent256e4874e9886e34ba7ebdad769a866d3a6fd3b8 (diff)
downloademacs-2dc3be7eba48b17a9eb8f02783e49999307491d0.tar.gz
emacs-2dc3be7eba48b17a9eb8f02783e49999307491d0.zip
(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')
-rw-r--r--src/fileio.c14
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.")
1949 if (set_file_times (XSTRING (newname)->data, atime, mtime)) 1949 if (set_file_times (XSTRING (newname)->data, atime, mtime))
1950 report_file_error ("I/O error", Fcons (newname, Qnil)); 1950 report_file_error ("I/O error", Fcons (newname, Qnil));
1951 } 1951 }
1952#ifndef MSDOS
1953 chmod (XSTRING (newname)->data, st.st_mode & 07777);
1954#else /* MSDOS */
1955#if defined (__DJGPP__) && __DJGPP__ > 1
1956 /* In DJGPP v2.0 and later, fstat usually returns true file mode bits,
1957 and if it can't, it tells so. Otherwise, under MSDOS we usually
1958 get only the READ bit, which will make the copied file read-only,
1959 so it's better not to chmod at all. */
1960 if ((_djstat_flags & _STFAIL_WRITEBIT) == 0)
1952 chmod (XSTRING (newname)->data, st.st_mode & 07777); 1961 chmod (XSTRING (newname)->data, st.st_mode & 07777);
1962#endif /* DJGPP version 2 or newer */
1963#endif /* MSDOS */
1953 } 1964 }
1954 1965
1955 close (ifd); 1966 close (ifd);
@@ -2347,7 +2358,8 @@ check_executable (filename)
2347 && len >= 5 2358 && len >= 5
2348 && (stricmp ((suffix = filename + len-4), ".com") == 0 2359 && (stricmp ((suffix = filename + len-4), ".com") == 0
2349 || stricmp (suffix, ".exe") == 0 2360 || stricmp (suffix, ".exe") == 0
2350 || stricmp (suffix, ".bat") == 0)); 2361 || stricmp (suffix, ".bat") == 0)
2362 || (st.st_mode & S_IFMT) == S_IFDIR);
2351#else /* not DOS_NT */ 2363#else /* not DOS_NT */
2352#ifdef HAVE_EACCESS 2364#ifdef HAVE_EACCESS
2353 return (eaccess (filename, 1) >= 0); 2365 return (eaccess (filename, 1) >= 0);