zig
zig copied to clipboard
POSIX link() syscall only takes two arguments (no flags)
The signature is documented as:
int link(const char *, const char *);
(see https://man7.org/linux/man-pages/man2/link.2.html or https://man.netbsd.org/link.2)
And its not some Linux extension, the syscall implementation only expects two arguments too.
It probably should have a flags parameter, but its too late now.
I am a bit surprised that linking glibc or musl against Zig code that invokes a 'link' with three parameters doesn't fail (at least, I couldn't get any local test cases to trigger a compile or link error). But the extra argument should be harmless anyway.
The test case in std/posix/test.zig is currently disabled, but if I manually enable it, it works with this change.
I guess this was just copy/paste error?
I am a bit surprised that linking glibc or musl against Zig code that invokes a 'link' with three parameters doesn't fail (at least, I couldn't get any local test cases to trigger a compile or link error). But the extra argument should be harmless anyway.
C doesn't do name mangling in the C++ sense so it will happily link with mismatched parameters/arguments.
Thanks!