Source
static void convert_unix_to_telnet_eol(const char *buf, size_t offset, char *out_buf, size_t *out_offset)
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
static char prompt_char = '\0';
static int telnet_waitsocket(ZBX_SOCKET socket_fd, short mode)
{
int rc;
zbx_pollfd_t pd;
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __func__);
pd.fd = socket_fd;
pd.events = mode;
if (0 > (rc = zbx_socket_poll(&pd, 1, 100)))
{
zabbix_log(LOG_LEVEL_DEBUG, "%s() poll() error rc:%d errno:%d error:[%s]", __func__, rc,
zbx_socket_last_error(), strerror_from_system(zbx_socket_last_error()));
}
else if (0 < rc && POLLIN != (pd.revents & (POLLIN | POLLERR | POLLHUP | POLLNVAL)))
{
char *errmsg;
errmsg = socket_poll_error(pd.revents);
zabbix_log(LOG_LEVEL_DEBUG, "%s() %s", __func__, errmsg);
zbx_free(errmsg);
rc = ZBX_PROTO_ERROR;
}
zabbix_log(LOG_LEVEL_DEBUG, "End of %s():%d", __func__, rc);
return rc;