aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCiD- <jkercher43@gmail.com>2022-01-12 14:51:49 -0500
committerCiD- <jkercher43@gmail.com>2022-01-12 14:51:49 -0500
commit8eaafd5242bb66f1daca84776a5e8560f65a3aa9 (patch)
tree866371a66317d4a01bb2a43f78a60383e2bda0e5
parent774951e8c0bfca3f9cdd445a003134d8f315ccd4 (diff)
check correct errno in _readlink
-rw-r--r--core/os/os_linux.odin4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/os/os_linux.odin b/core/os/os_linux.odin
index 6b2fda1e3..1c796f1b8 100644
--- a/core/os/os_linux.odin
+++ b/core/os/os_linux.odin
@@ -666,9 +666,9 @@ _readlink :: proc(path: string) -> (string, Errno) {
buf := make([]byte, bufsz)
for {
rc := _unix_readlink(path_cstr, &(buf[0]), bufsz)
- if rc == -1 {
+ if rc < 0 {
delete(buf)
- return "", Errno(get_last_error())
+ return "", _get_errno(rc)
} else if rc == int(bufsz) {
// NOTE(laleksic, 2021-01-21): Any cleaner way to resize the slice?
bufsz *= 2