summaryrefslogtreecommitdiff
path: root/data/nodejs/nodejs-mobile-filecopy.diff
blob: 600d96c9695ba97a752e62281b0a0b16b200b46d (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
--- node-v12.17.0/deps/uv/src/unix/fs.c	2020-05-26 06:53:32.000000000 -0500
+++ node-v12.17.0+iPhone/deps/uv/src/unix/fs.c	2020-05-27 00:54:19.883409601 -0500
@@ -1102,6 +1102,17 @@
 }
 
 static ssize_t uv__fs_copyfile(uv_fs_t* req) {
+#if defined(__APPLE__)
+  /* 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 +1269,7 @@
 
   errno = UV__ERR(result);
   return -1;
+#endif
 }
 
 static void uv__to_stat(struct stat* src, uv_stat_t* dst) {