comparison src/proxy.c @ 4648:4bb99cdfd837

[gaim-migrate @ 4959] Wrong value was being checked for socket error after call to getsockopt committer: Tailor Script <tailor@pidgin.im>
author Herman Bloggs <hermanator12002@yahoo.com>
date Tue, 04 Mar 2003 17:45:21 +0000
parents d19872836812
children 9ce3c698ff5e
comparison
equal deleted inserted replaced
4647:ba87412b1a57 4648:4bb99cdfd837
567 567
568 static void no_one_calls(gpointer data, gint source, GaimInputCondition cond) 568 static void no_one_calls(gpointer data, gint source, GaimInputCondition cond)
569 { 569 {
570 struct PHB *phb = data; 570 struct PHB *phb = data;
571 unsigned int len; 571 unsigned int len;
572 int error = ETIMEDOUT; 572 int error=0;
573 int ret=0;
573 574
574 debug_printf("Connected\n"); 575 debug_printf("Connected\n");
575 576
576 len = sizeof(error); 577 len = sizeof(error);
577 if (getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len) < 0) { 578
579 ret = getsockopt(source, SOL_SOCKET, SO_ERROR, &error, &len);
580 if (ret < 0 || error != 0) {
578 close(source); 581 close(source);
579 gaim_input_remove(phb->inpa); 582 gaim_input_remove(phb->inpa);
580 phb->func(phb->data, -1, GAIM_INPUT_READ); 583 phb->func(phb->data, -1, GAIM_INPUT_READ);
581 g_free(phb->host); 584 g_free(phb->host);
582 g_free(phb); 585 g_free(phb);
586 debug_printf("getsockopt SO_ERROR check: %s\n",
587 strerror(((ret<0) ? errno : error)));
583 return; 588 return;
584 } 589 }
585 fcntl(source, F_SETFL, 0); 590 fcntl(source, F_SETFL, 0);
586 gaim_input_remove(phb->inpa); 591 gaim_input_remove(phb->inpa);
587 phb->func(phb->data, source, GAIM_INPUT_READ); 592 phb->func(phb->data, source, GAIM_INPUT_READ);