summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-08-12 14:39:10 +0000
committermidipix <writeonce@midipix.org>2018-08-13 19:23:27 -0400
commit5822915ed1835a618fdf1b37aa073b99748159fa (patch)
treebd6957b8d5f9ca068197b52cb7ab93af1b6b7abc /src
parent598944c893f8eec1680890353ae32f9d52bc4ffd (diff)
downloadptycon-5822915ed1835a618fdf1b37aa073b99748159fa.tar.bz2
ptycon-5822915ed1835a618fdf1b37aa073b99748159fa.tar.xz
ptyc_write(): apply correct return value logic.
Diffstat (limited to 'src')
-rw-r--r--src/internal/ptycon_ntaio_impl.c15
1 files changed, 11 insertions, 4 deletions
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;
}