SCCS-vsn: lib/libc/db/hash/hash.c 5.7
*/
#if defined(LIBC_SCCS) && !defined(lint)
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)hash.c 5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)hash.c 5.7 (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
if ( !file ||
(flags & O_TRUNC) ||
(stat ( file, &statbuf ) && (errno == ENOENT)) ) {
if ( !file ||
(flags & O_TRUNC) ||
(stat ( file, &statbuf ) && (errno == ENOENT)) ) {
+ if ( errno == ENOENT ) {
+ errno = 0; /* Just in case someone looks at errno */
+ }
(hashp->BSIZE << BYTE_SHIFT) - 1) >>
(hashp->BSHIFT + BYTE_SHIFT);
(hashp->BSIZE << BYTE_SHIFT) - 1) >>
(hashp->BSHIFT + BYTE_SHIFT);
hashp->mapp[0] = (u_long *)malloc(bpages<<hashp->BSHIFT);
if ( !hashp->mapp[0] ) {
RETURN_ERROR(errno, error2);
hashp->mapp[0] = (u_long *)malloc(bpages<<hashp->BSHIFT);
if ( !hashp->mapp[0] ) {
RETURN_ERROR(errno, error2);
if (flush_meta() && !save_errno) {
save_errno = errno;
}
if (flush_meta() && !save_errno) {
save_errno = errno;
}
+
+ /* Free Initial Bigmaps */
+ if ( hashp->nmaps ) {
+ (void)free(hashp->mapp[0]);
+ }
+
+ /* Free extra bitmaps */
+ for ( mapp = &hashp->mapp[hashp->nmaps];
+ hashp->exmaps--;
+ mapp++ ) {
+ (void) free ( *mapp );
+ }
+
if ( hashp->fp != -1 ) {
(void)close (hashp->fp);
}
if ( hashp->fp != -1 ) {
(void)close (hashp->fp);
}