termdesc: only bounce back to cbreak if fd >= 0 #1469

pull/1764/head
nick black 3 years ago committed by Nick Black
parent 288381d5b9
commit 309d211cde

@ -398,7 +398,7 @@ int interrogate_terminfo(tinfo* ti, int fd, const char* termname, unsigned utf8,
} }
} }
if(ncinputlayer_init(ti, stdin)){ if(ncinputlayer_init(ti, stdin)){
return -1; goto err;
} }
// our current sixel quantization algorithm requires at least 64 color // our current sixel quantization algorithm requires at least 64 color
// registers. we make use of no more than 256. // registers. we make use of no more than 256.
@ -406,11 +406,15 @@ int interrogate_terminfo(tinfo* ti, int fd, const char* termname, unsigned utf8,
setup_sixel_bitmaps(ti); setup_sixel_bitmaps(ti);
} }
if(!nocbreak){ if(!nocbreak){
if(tcsetattr(fd, TCSANOW, &ti->tpreserved)){ if(fd >= 0){
return -1; if(tcsetattr(fd, TCSANOW, &ti->tpreserved)){
ncinputlayer_stop(&ti->input);
goto err;
}
} }
} }
if(apply_term_heuristics(ti, termname, fd)){ if(apply_term_heuristics(ti, termname, fd)){
ncinputlayer_stop(&ti->input);
goto err; goto err;
} }
return 0; return 0;

Loading…
Cancel
Save