commit - 62f74db6f62ab36bd278e25aa489e0cb20e0023f
commit + 2b4b416d2f034214c11cbd36d9529cf9e4c31ace
blob - 6e96bd56b0d5635324e8c04f71f41f4b4b94d66a
blob + 436738db0a96e992b563bbfbf0d9182db930dc98
--- src/ngircd/array.c
+++ src/ngircd/array.c
#include "array.h"
-static char UNUSED id[] = "$Id: array.c,v 1.11 2006/07/01 22:11:48 fw Exp $";
+static char UNUSED id[] = "$Id: array.c,v 1.11.2.1 2006/12/02 13:00:25 fw Exp $";
#include <assert.h>
assert(size > 0);
- if (pos_plus1 < pos)
- return NULL;
-
- if (!safemult_sizet(size, pos_plus1, &alloc))
+ if (pos_plus1 == 0 || !safemult_sizet(size, pos_plus1, &alloc))
return NULL;
if (a->allocated < alloc) {
if (a->allocated < totalsize)
return NULL;
- return a->mem + pos * membersize;
+ return a->mem + totalsize;
}
a->mem = NULL;
a->allocated = 0;
a->used = 0;
-}
-
-
-void
-array_free_wipe(array * a)
-{
- if (!array_UNUSABLE(a))
- memset(a->mem, 0, a->allocated);
-
- array_free(a);
}
assert(a != NULL);
assert(membersize > 0);
- if (!pos)
- return;
-
if (!safemult_sizet(membersize, pos, &bytepos)) {
a->used = 0;
return;
blob - 7f10698d3aab9437e9f71947343753b154c37660
blob + a145fdf39fc94bd1c9c408ad4b1c27e7e18b696c
--- 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.24.2.1 2006/12/02 13:00:25 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- */