]> git.eshelyaron.com Git - emacs.git/commitdiff
Implement renameat_noreplace on recent Cygwin
authorKen Brown <kbrown@cornell.edu>
Sun, 10 Sep 2017 15:00:35 +0000 (11:00 -0400)
committerKen Brown <kbrown@cornell.edu>
Sun, 10 Sep 2017 15:04:30 +0000 (11:04 -0400)
* src/sysdep.c [CYGWIN]: Include cygwin/fs.h.
(renameat_noreplace) [RENAME_NOREPLACE]: Use renameat2.
(Bug#27986)

src/sysdep.c

index b66a7453172eff684f27322f220a0e4871284d9e..f5050e60f439e073b56ef4156aea11fb1c6c1d89 100644 (file)
@@ -42,6 +42,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 # include <sys/syscall.h>
 #endif
 
+#ifdef CYGWIN
+# include <cygwin/fs.h>
+#endif
+
 #if defined DARWIN_OS || defined __FreeBSD__
 # include <sys/sysctl.h>
 #endif
@@ -2685,6 +2689,8 @@ renameat_noreplace (int srcfd, char const *src, int dstfd, char const *dst)
 {
 #if defined SYS_renameat2 && defined RENAME_NOREPLACE
   return syscall (SYS_renameat2, srcfd, src, dstfd, dst, RENAME_NOREPLACE);
+#elif defined RENAME_NOREPLACE /* Cygwin >= 2.9.0. */
+  return renameat2 (srcfd, src, dstfd, dst, RENAME_NOREPLACE);
 #elif defined RENAME_EXCL
   return renameatx_np (srcfd, src, dstfd, dst, RENAME_EXCL);
 #else