mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05: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:
parent
2790a3b0b5
commit
fa1715b515
@ -127,13 +127,16 @@ int net_gethostbyname_return(GIOChannel *pipe, RESOLVED_IP_REC *rec)
|
|||||||
rec->error = -1;
|
rec->error = -1;
|
||||||
rec->errorstr = NULL;
|
rec->errorstr = NULL;
|
||||||
|
|
||||||
/* get ip+error - try for max. 1-2 seconds */
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
fcntl(g_io_channel_unix_get_fd(pipe), F_SETFL, O_NONBLOCK);
|
fcntl(g_io_channel_unix_get_fd(pipe), F_SETFL, O_NONBLOCK);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (g_io_channel_read_block(pipe, rec, sizeof(*rec)) == -1)
|
/* get ip+error */
|
||||||
return -1;
|
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) {
|
if (rec->error) {
|
||||||
/* read error string, if we can't read everything for some
|
/* read error string, if we can't read everything for some
|
||||||
|
Loading…
Reference in New Issue
Block a user