Skip to content
Advertisement

Setting signal for SIGWINCH causes output on terminal?

When I set up a signal handler for SIGWINCH that does nothing, resizing the terminal window causes a reverse ? character to show up, get several of them as I resize the window around. If I don’t setup a signal handler, that doesn’t happen. Why is it doing that and How do I stop that?

More information: I dump what the chars were, when you start the first char is 0xFF, then 0xBF after that (always 0xBF), until you stop and start again, then repeats.

TIA

void sigwinchhandler(int signo)
{
}

struct sigaction sa, priorsa;
sigemptyset(&sa.sa_mask);
sa.sa_flags = 0;
sa.sa_handler = sigwinchhandler;
sigaction(SIGWINCH, &sa, &priorsa);
// NOTE: priorsa.sa_handler==NULL, priorsa.sa_sigaction==NULL, priorsa.sa_flags==0

Advertisement

Answer

Fix is to set:

sa.sa_flags = SA_RESTART;

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement