commit - 8423b89996574f5cce35b322482977b38262e507
commit + 939ee6a39b04e8417fa594ae8881b617ffd00029
blob - 7f10698d3aab9437e9f71947343753b154c37660
blob + ec993037cb6c6badf96b54395edfee9bd605aa35
--- src/ngircd/resolve.c
+++ src/ngircd/resolve.c
#include "portab.h"
-static char UNUSED id[] = "$Id: resolve.c,v 1.24 2006/05/10 21:24:01 alex Exp $";
+static char UNUSED id[] = "$Id: resolve.c,v 1.25 2006/08/12 11:54:23 fw Exp $";
#include "imp.h"
#include <assert.h>
GLOBAL size_t
Resolve_Read( RES_STAT *s, void* readbuf, size_t buflen)
{
- int err;
ssize_t bytes_read;
assert(buflen > 0);
/* Read result from pipe */
- errno = 0;
bytes_read = read(s->resolver_fd, readbuf, buflen);
if (bytes_read < 0) {
- if (errno != EAGAIN) {
- err = errno;
- Log( LOG_CRIT, "Resolver: Can't read result: %s!", strerror(err));
- Resolve_Shutdown(s);
- errno = err;
+ if (errno == EAGAIN)
return 0;
- }
- return 0;
- }
- Resolve_Shutdown(s);
- if (bytes_read == 0) { /* EOF: lookup failed */
+ Log( LOG_CRIT, "Resolver: Can't read result: %s!", strerror(errno));
+ bytes_read = 0;
+ }
#ifdef DEBUG
+ else if (bytes_read == 0)
Log( LOG_DEBUG, "Resolver: Can't read result: EOF");
#endif
- return 0;
- }
-
+ Resolve_Shutdown(s);
return (size_t)bytes_read;
}
/* -eof- */