2012-04-01 Giuseppe Scrivano <gscrivano@gnu.org>
+ * gnutls.c (wgnutls_read_timeout): Ensure timer is freed.
+
* gnutls.c (wgnutls_read_timeout): Do not use timer if it is not
allocated.
Reported by: Xu Zhongxing <xu_zhong_xing@163.com>
if (timeout)
{
#ifdef F_GETFL
- ret = fcntl (fd, F_SETFL, flags | O_NONBLOCK);
- if (ret < 0)
- return ret;
+ if (fcntl (fd, F_SETFL, flags | O_NONBLOCK))
+ break;
#else
/* XXX: Assume it was blocking before. */
const int one = 1;
- ret = ioctl (fd, FIONBIO, &one);
- if (ret < 0)
- return ret;
+ if (ioctl (fd, FIONBIO, &one) < 0)
+ break;
#endif
}
if (timeout)
{
- int status;
#ifdef F_GETFL
- status = fcntl (fd, F_SETFL, flags);
- if (status < 0)
- return status;
+ if (fcntl (fd, F_SETFL, flags) < 0)
+ break;
#else
const int zero = 0;
- status = ioctl (fd, FIONBIO, &zero);
- if (status < 0)
- return status;
+ if (ioctl (fd, FIONBIO, &zero) < 0)
+ break;
#endif
}
}