summaryrefslogtreecommitdiff
path: root/data/nodejs/nodejs-mobile-filecopy.diff
blob: f6b5718506cfa23ac9a04bb7304301a79ffa741d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
diff -Naur node-v12.17.0/deps/uv/src/unix/fs.c node-v12.17.0+iPhone/deps/uv/src/unix/fs.c
--- node-v12.17.0/deps/uv/src/unix/fs.c	2020-05-26 04:53:32.000000000 -0700
+++ node-v12.17.0+iPhone/deps/uv/src/unix/fs.c	2020-05-27 20:56:16.000000000 -0700
@@ -1102,6 +1102,19 @@
 }
 
 static ssize_t uv__fs_copyfile(uv_fs_t* req) {
+#if defined(__APPLE__)
+#include <copyfile.h>
+
+  /* On macOS, use the native copyfile(3). */
+  copyfile_flags_t flags;
+
+  flags = COPYFILE_ALL;
+
+  if (req->flags & UV_FS_COPYFILE_EXCL)
+    flags |= COPYFILE_EXCL;
+
+  return copyfile(req->path, req->new_path, NULL, flags);
+#else
   uv_fs_t fs_req;
   uv_file srcfd;
   uv_file dstfd;
@@ -1258,6 +1271,7 @@
 
   errno = UV__ERR(result);
   return -1;
+#endif
 }
 
 static void uv__to_stat(struct stat* src, uv_stat_t* dst) {