From 5822915ed1835a618fdf1b37aa073b99748159fa Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 12 Aug 2018 14:39:10 +0000 Subject: ptyc_write(): apply correct return value logic. --- src/internal/ptycon_ntaio_impl.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src') 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; } -- cgit v1.2.3