summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorepoch <epoch@thebackupbox.net>2020-04-06 06:03:32 -0500
committerepoch <epoch@thebackupbox.net>2020-04-06 06:03:32 -0500
commit48fe341421279208e090f9d25794aa59a02de8ec (patch)
tree12943de7d9922da6afe3fae6c03a9e8e129bc7ad /share
parentcfa28d6442dbb4b8037b5538f7bbd95604c261de (diff)
downloadhackvr-48fe341421279208e090f9d25794aa59a02de8ec.tar.gz
hackvr-48fe341421279208e090f9d25794aa59a02de8ec.zip
added better error checking to not just assume EAGAIN
Diffstat (limited to 'share')
-rw-r--r--share/hackvr/examples/hackvr_term/pty.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/share/hackvr/examples/hackvr_term/pty.c b/share/hackvr/examples/hackvr_term/pty.c
index d894359..6903bc3 100644
--- a/share/hackvr/examples/hackvr_term/pty.c
+++ b/share/hackvr/examples/hackvr_term/pty.c
@@ -5,6 +5,7 @@
#include <sys/wait.h>
#include <stdlib.h>
#include <unistd.h>
+#include <errno.h>
int main(int argc,char *argv[]) {
char *pts;
@@ -56,12 +57,12 @@ int main(int argc,char *argv[]) {
}
switch(r=read(0,&in,1)) {
case 0: eof1=1;;//EOF
- case -1: break;//EAGAIN probably.
+ case -1: if(errno != EAGAIN) eof1=1; break;//EAGAIN probably.
default: write(master,&in,r);
}
switch(r=read(master,&in,1)) {
case 0: eof2=1;;//EOF
- case -1: break;//EAGAIN probably
+ case -1: if(errno != EAGAIN) eof2=1; break;//EAGAIN probably
default: write(1,&in,r);
}
usleep(100);//kek