File tree Expand file tree Collapse file tree
libc-bottom-half/cloudlibc/src/common Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ static inline __wasi_errno_t errno_fixup_directory(__wasi_fd_t fd,
1919 return error ;
2020}
2121
22+ #ifdef __wasilibc_unmodified_upstream // posix_spawn etc.
2223// Translates ENOTCAPABLE to EBADF if a regular file or EACCES otherwise.
2324static inline __wasi_errno_t errno_fixup_executable (__wasi_fd_t fd ,
2425 __wasi_errno_t error ) {
@@ -31,6 +32,7 @@ static inline __wasi_errno_t errno_fixup_executable(__wasi_fd_t fd,
3132 }
3233 return error ;
3334}
35+ #endif
3436
3537#ifdef __wasilibc_unmodified_upstream // process file descriptors
3638// Translates ENOTCAPABLE to EINVAL if not a process.
@@ -52,7 +54,12 @@ static inline __wasi_errno_t errno_fixup_socket(__wasi_fd_t fd,
5254 if (error == __WASI_ENOTCAPABLE ) {
5355 __wasi_fdstat_t fds ;
5456 if (__wasi_fd_stat_get (fd , & fds ) == 0 &&
57+ #ifdef __wasilibc_unmodified_upstream // don't hard-code magic numbers
5558 (fds .fs_filetype & 0xf0 ) != 0x80 )
59+ #else
60+ (fds .fs_filetype != __WASI_FILETYPE_SOCKET_STREAM &&
61+ fds .fs_filetype != __WASI_FILETYPE_SOCKET_DGRAM ))
62+ #endif
5663 return __WASI_ENOTSOCK ;
5764 }
5865 return error ;
You can’t perform that action at this time.
0 commit comments