Hi Vinicius, On Thu, Oct 06, 2011, Vinicius Costa Gomes wrote: > --- > +static void sigint_handler(int sig) > +{ > + int err; > + > + setsockopt(signal_data.fd, SOL_HCI, HCI_FILTER, &signal_data.of, sizeof(signal_data.of)); > + > + err = hci_le_set_scan_enable(signal_data.fd, 0x00, 0x00, 1000); > + if (err < 0) { > + perror("Disable scan failed"); > + exit(1); > + } > + > + hci_close_dev(signal_data.fd); > + > + exit(0); > +} To my understanding the general recommendation is to do as little as possible within signal handlers. Would it therefore make more sense to simply set a flag (indicating which signal was received) in the handler, and then do the necessary cleanup within the original function by handling EINTR there (presumably returned by the read system call)? Johan -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html