mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-02 20:58:15 +00:00
Merge remote-tracking branch 'offical/master'
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// Cross-platform `OS` interactions like file `I/O`.
|
||||
package os
|
||||
|
||||
import "base:intrinsics"
|
||||
|
||||
@@ -199,7 +199,7 @@ _get_full_path :: proc(fd: linux.Fd, allocator: runtime.Allocator) -> (fullpath:
|
||||
buf: [32]u8
|
||||
copy(buf[:], PROC_FD_PATH)
|
||||
|
||||
strconv.itoa(buf[len(PROC_FD_PATH):], int(fd))
|
||||
strconv.write_int(buf[len(PROC_FD_PATH):], i64(fd), 10)
|
||||
|
||||
if fullpath, err = _read_link_cstr(cstring(&buf[0]), allocator); err != nil || fullpath[0] != '/' {
|
||||
delete(fullpath, allocator)
|
||||
|
||||
@@ -908,7 +908,7 @@ _dup :: proc(fd: Handle) -> (Handle, Error) {
|
||||
@(require_results)
|
||||
absolute_path_from_handle :: proc(fd: Handle) -> (string, Error) {
|
||||
buf : [256]byte
|
||||
fd_str := strconv.itoa( buf[:], cast(int)fd )
|
||||
fd_str := strconv.write_int( buf[:], cast(i64)fd, 10 )
|
||||
|
||||
procfs_path := strings.concatenate( []string{ "/proc/self/fd/", fd_str } )
|
||||
defer delete(procfs_path)
|
||||
|
||||
Reference in New Issue
Block a user