/* Check if the output descriptor has something connected to the slave side.  */
int np_uart_slave_connected(int fd)
/* Check if the output descriptor has something connected to the slave side.  */
int np_uart_slave_connected(int fd)
{
	struct pollfd pfd = { .fd = fd, .events = POLLHUP };
	int ret;
	ret = poll(&pfd, 1, 0);
	if (ret == -1) {
		int err = errno;
		if (err != EINTR) {
			ERROR("%s: unexpected error during poll, errno=%i,%s\n",
			      __func__, err, strerror(err));
		}
	}
	if (!(pfd.revents & POLLHUP)) {
		return 1;
	}
	return 0;
}