diff --git a/src/internal/ptycon_ntaio_impl.c b/src/internal/ptycon_ntaio_impl.c index 4ab5ca4..cf3f1ea 100644 --- a/src/internal/ptycon_ntaio_impl.c +++ b/src/internal/ptycon_ntaio_impl.c @@ -110,13 +110,20 @@ int ptyc_write(int fd, const void * buf, size_t size) 0,0); /* wait */ - if (status == NT_STATUS_PENDING) - status = ptyc_ntapi->zw_wait_for_single_object( - hevent,0,0); + switch (status) { + case NT_STATUS_PENDING: + status = ptyc_ntapi->zw_wait_for_single_object( + hevent,0,0); + break; + + default: + iosb.status = status; + break; + } /* hevent */ ptyc_ntapi->zw_close(hevent); /* ret */ - return status ? status : iosb.status; + return iosb.status ? iosb.status : iosb.info; }