Skip to content

Commit 390c7d8

Browse files
authored
Merge pull request #19833 from tealsnow/posix-INVAL
std.posix: handle INVAL in openZ, openatZ and openatWasi
2 parents ed7f11f + 0403c4b commit 390c7d8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/std/posix.zig

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1598,7 +1598,7 @@ pub fn openZ(file_path: [*:0]const u8, flags: O, perm: mode_t) OpenError!fd_t {
15981598
.INTR => continue,
15991599

16001600
.FAULT => unreachable,
1601-
.INVAL => unreachable,
1601+
.INVAL => return error.BadPathName,
16021602
.ACCES => return error.AccessDenied,
16031603
.FBIG => return error.FileTooBig,
16041604
.OVERFLOW => return error.FileTooBig,
@@ -1676,7 +1676,8 @@ pub fn openatWasi(
16761676
.INTR => continue,
16771677

16781678
.FAULT => unreachable,
1679-
.INVAL => unreachable,
1679+
// Provides INVAL with a linux host on a bad path name, but NOENT on Windows
1680+
.INVAL => return error.BadPathName,
16801681
.BADF => unreachable,
16811682
.ACCES => return error.AccessDenied,
16821683
.FBIG => return error.FileTooBig,
@@ -1767,7 +1768,7 @@ pub fn openatZ(dir_fd: fd_t, file_path: [*:0]const u8, flags: O, mode: mode_t) O
17671768
.INTR => continue,
17681769

17691770
.FAULT => unreachable,
1770-
.INVAL => unreachable,
1771+
.INVAL => return error.BadPathName,
17711772
.BADF => unreachable,
17721773
.ACCES => return error.AccessDenied,
17731774
.FBIG => return error.FileTooBig,

0 commit comments

Comments
 (0)