commit 2b4b416d2f034214c11cbd36d9529cf9e4c31ace from: Florian Westphal date: Sat Dec 02 13:00:25 2006 UTC cleanups [from HEAD] commit - 62f74db6f62ab36bd278e25aa489e0cb20e0023f commit + 2b4b416d2f034214c11cbd36d9529cf9e4c31ace blob - 6e96bd56b0d5635324e8c04f71f41f4b4b94d66a blob + 436738db0a96e992b563bbfbf0d9182db930dc98 --- src/ngircd/array.c +++ src/ngircd/array.c @@ -12,7 +12,7 @@ #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 @@ -66,10 +66,7 @@ array_alloc(array * a, size_t size, size_t pos) 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) { @@ -263,7 +260,7 @@ array_get(array * a, size_t membersize, size_t pos) if (a->allocated < totalsize) return NULL; - return a->mem + pos * membersize; + return a->mem + totalsize; } @@ -280,16 +277,6 @@ array_free(array * a) 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); } @@ -331,9 +318,6 @@ array_moveleft(array * a, size_t membersize, size_t po 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 @@ -14,7 +14,7 @@ #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 @@ -340,33 +340,24 @@ Resolve_Shutdown( RES_STAT *s) 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- */