Skip to content

Commit

Permalink
termdesc: only bounce back to cbreak if fd >= 0 #1469
Browse files Browse the repository at this point in the history
  • Loading branch information
dankamongmen committed Jun 13, 2021
1 parent a62e31e commit b5b8cd5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/lib/termdesc.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,19 +398,23 @@ int interrogate_terminfo(tinfo* ti, int fd, const char* termname, unsigned utf8,
}
}
if(ncinputlayer_init(ti, stdin)){
return -1;
goto err;
}
// our current sixel quantization algorithm requires at least 64 color
// registers. we make use of no more than 256.
if(ti->color_registers >= 64){
setup_sixel_bitmaps(ti);
}
if(!nocbreak){
if(tcsetattr(fd, TCSANOW, &ti->tpreserved)){
return -1;
if(fd >= 0){
if(tcsetattr(fd, TCSANOW, &ti->tpreserved)){
ncinputlayer_stop(&ti->input);
goto err;
}
}
}
if(apply_term_heuristics(ti, termname, fd)){
ncinputlayer_stop(&ti->input);
goto err;
}
return 0;
Expand Down

0 comments on commit b5b8cd5

Please sign in to comment.