1
0
mirror of https://github.com/irssi/irssi.git synced 2024-06-30 06:45:25 +00:00

If reading host answer from pipe failed, set the error message to

"Host name lookup: g_strerror(errno)"


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1244 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-02-19 02:13:02 +00:00 committed by cras
parent 2790a3b0b5
commit fa1715b515

View File

@ -127,13 +127,16 @@ int net_gethostbyname_return(GIOChannel *pipe, RESOLVED_IP_REC *rec)
rec->error = -1;
rec->errorstr = NULL;
/* get ip+error - try for max. 1-2 seconds */
#ifndef WIN32
fcntl(g_io_channel_unix_get_fd(pipe), F_SETFL, O_NONBLOCK);
#endif
if (g_io_channel_read_block(pipe, rec, sizeof(*rec)) == -1)
return -1;
/* get ip+error */
if (g_io_channel_read_block(pipe, rec, sizeof(*rec)) == -1) {
rec->errorstr = g_strdup_printf("Host name lookup: %s",
g_strerror(errno));
return -1;
}
if (rec->error) {
/* read error string, if we can't read everything for some