@@ -2674,6 +2674,7 @@ pub const ReadLinkError = error{
2674
2674
NameTooLong ,
2675
2675
FileNotFound ,
2676
2676
SystemResources ,
2677
+ NotLink ,
2677
2678
NotDir ,
2678
2679
InvalidUtf8 ,
2679
2680
BadPathName ,
@@ -2715,7 +2716,7 @@ pub fn readlinkZ(file_path: [*:0]const u8, out_buffer: []u8) ReadLinkError![]u8
2715
2716
.SUCCESS = > return out_buffer [0.. @bitCast (usize , rc )],
2716
2717
.ACCES = > return error .AccessDenied ,
2717
2718
.FAULT = > unreachable ,
2718
- .INVAL = > unreachable ,
2719
+ .INVAL = > return error . NotLink ,
2719
2720
.IO = > return error .FileSystem ,
2720
2721
.LOOP = > return error .SymLinkLoop ,
2721
2722
.NAMETOOLONG = > return error .NameTooLong ,
@@ -2751,7 +2752,7 @@ pub fn readlinkatWasi(dirfd: fd_t, file_path: []const u8, out_buffer: []u8) Read
2751
2752
.SUCCESS = > return out_buffer [0.. bufused ],
2752
2753
.ACCES = > return error .AccessDenied ,
2753
2754
.FAULT = > unreachable ,
2754
- .INVAL = > unreachable ,
2755
+ .INVAL = > return error . NotLink ,
2755
2756
.IO = > return error .FileSystem ,
2756
2757
.LOOP = > return error .SymLinkLoop ,
2757
2758
.NAMETOOLONG = > return error .NameTooLong ,
@@ -2781,7 +2782,7 @@ pub fn readlinkatZ(dirfd: fd_t, file_path: [*:0]const u8, out_buffer: []u8) Read
2781
2782
.SUCCESS = > return out_buffer [0.. @bitCast (usize , rc )],
2782
2783
.ACCES = > return error .AccessDenied ,
2783
2784
.FAULT = > unreachable ,
2784
- .INVAL = > unreachable ,
2785
+ .INVAL = > return error . NotLink ,
2785
2786
.IO = > return error .FileSystem ,
2786
2787
.LOOP = > return error .SymLinkLoop ,
2787
2788
.NAMETOOLONG = > return error .NameTooLong ,
@@ -4758,6 +4759,7 @@ pub fn getFdPath(fd: fd_t, out_buffer: *[MAX_PATH_BYTES]u8) RealPathError![]u8 {
4758
4759
const target = readlinkZ (std .meta .assumeSentinel (proc_path .ptr , 0 ), out_buffer ) catch | err | {
4759
4760
switch (err ) {
4760
4761
error .UnsupportedReparsePointType = > unreachable , // Windows only,
4762
+ error .NotLink = > unreachable ,
4761
4763
else = > | e | return e ,
4762
4764
}
4763
4765
};
@@ -4769,6 +4771,7 @@ pub fn getFdPath(fd: fd_t, out_buffer: *[MAX_PATH_BYTES]u8) RealPathError![]u8 {
4769
4771
4770
4772
const target = readlinkZ (proc_path , out_buffer ) catch | err | switch (err ) {
4771
4773
error .UnsupportedReparsePointType = > unreachable ,
4774
+ error .NotLink = > unreachable ,
4772
4775
else = > | e | return e ,
4773
4776
};
4774
4777
return target ;
0 commit comments