Files
aya-mirror/xtask/patches/gen_init_cpio.c.macos.diff
Tamir Duberstein bb45904b08 xtask: patch gen_init_cpio.c
Recent changes[0][1] have broken compatibility with macOS; add a patch
to conditionally compile these snippets.

Patch and compile the source unconditionally; caching only the network
portion is good enough and less error prone.

[0] ae18b94099
[1] 97169cd6d9
2025-10-03 12:03:00 -04:00

33 lines
971 B
Diff

diff --git a/gen_init_cpio.c b/gen_init_cpio.c
index 75e9561b..406c4d0a 100644
--- a/gen_init_cpio.c
+++ b/gen_init_cpio.c
@@ -453,6 +453,7 @@ static int cpio_mkfile(const char *name, const char *location,
push_pad(namepadlen ? namepadlen : padlen(offset, 4)) < 0)
goto error;
+#ifdef __linux__
if (size) {
this_read = copy_file_range(file, NULL, outfd, NULL, size, 0);
if (this_read > 0) {
@@ -463,6 +464,7 @@ static int cpio_mkfile(const char *name, const char *location,
}
/* short or failed copy falls back to read/write... */
}
+#endif
while (size) {
unsigned char filebuf[65536];
@@ -671,7 +673,10 @@ int main (int argc, char *argv[])
break;
case 'o':
outfd = open(optarg,
- O_WRONLY | O_CREAT | O_LARGEFILE | O_TRUNC,
+#ifdef O_LARGEFILE
+ O_LARGEFILE |
+#endif
+ O_WRONLY | O_CREAT | O_TRUNC,
0600);
if (outfd < 0) {
fprintf(stderr, "failed to open %s\n", optarg);