-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
can't get errno when libc lstat returns -1 #11878
Comments
I’ve just stumbled upon this bug aswell when I was using Zig to compile C++ code on Linux. It works correctly with musl as the target, but is broken with glibc. I’m on Zig version 0.10.0-dev.2674+d980c6a38 |
I did some investigations on this issue and I think I found the culprit: zig has its own implementation of So this explains why we didn't get the correct errno when |
This breaks using libgit2 with zig cc for me, since it relies on the lstat errno when creating the directory for cloning a repository (https://github.com/libgit2/libgit2/blob/1327dbcf2a4273a8ba6fd978db5f0882530af94d/src/util/futils.c#L527-L535) |
Pretty sure I'm experiencing the same problem with sqlite which uses ltstat/errno to validate the path of a database to open. |
Zig Version
0.9.1
Steps to Reproduce
Expected Behavior
The output should be:
ret = -1, c.errno = 2
.Actual Behavior
But the actual output is
ret = -1, c.errno = 0
. Theerrno
is not set correctly.The text was updated successfully, but these errors were encountered: