That test needs to be augmented with a condition that won't be true unless
callback mode is actually active. You should be able to test
RL_STATE_CALLBACK using RL_ISSTATE(), but you might also want to test
whether rl_linefunc is non-null. Let me know what works for you.
Looking at the code I think that RL_ISSTATE (RL_STATE_CALLBACK) will be
true only when rl_linefunc != NULL and vice versa, so I think just
checking one of these will be fine.
The patch below calls rl_echo_signal_char when RL_STATE_CALLBACK is not
set, or when rl_persistent_signal_handlers is true, which I think covers
all the cases.