Commit Graph

162 Commits

Author SHA1 Message Date
christos 3c2585b945 correct cast to size_t. 2009-04-23 22:09:23 +00:00
agc 9c3b1325df Cast the arg to an unsigned value to let this compile 2009-04-23 03:49:39 +00:00
njoly 41f89f9e08 Include string.h for memset prototype. 2009-04-22 21:52:59 +00:00
christos 0f03f83ae4 Avoid information leaks by zeroing memory, from FreeBSD (we had done some
already)
2009-04-22 18:44:06 +00:00
joerg 59ba3c43a4 -width needs an argument, so provide one. 2009-04-11 20:39:15 +00:00
lukem c7201a0f39 fix -Wsign-compare issues 2009-02-12 06:35:54 +00:00
lukem eb0de3bfe5 fix sign-compare issues 2009-02-12 06:33:13 +00:00
lukem 79becf98cb sign-compare fixes 2009-01-29 02:02:36 +00:00
tsutsui 61a62e59f7 unsigned int32_t -> uint32_t 2008-09-26 11:41:06 +00:00
joerg d3595ddff7 Consistently include "nbtool_config.h" when cross-compiling. 2008-09-11 12:58:00 +00:00
joerg 65f930bc37 Remove one remaining sccsid. 2008-09-11 12:33:55 +00:00
joerg 52c4a82ef2 In preparation for providing a db fallback in libnbcompat, remove
sccsid and conditionals around __RCSID. lint understands __RCSID enough
to ignore it, undefining LIBC_SCCS is superseded by MKSTRIPIDENT.
No functional changes.
2008-09-10 17:52:35 +00:00
lukem 4e3bc9a2d6 Expand the description of bsize, and correct the description of the default. 2008-09-05 06:25:04 +00:00
joerg dcb3546b5c Fix __log2 to not loop for 0x80000000 and higher. 2008-08-28 11:00:43 +00:00
joerg 40b37a3bf2 Convert db from UCB types to POSIX types. Prefer uint8_t for u_char as
it is mostly about the wire format.

Patched libc.so is bit-identical.

OK matt@
2008-08-26 21:18:38 +00:00
joerg 8609f98c0c mpool.libtp seems to be an ancient copy of mpool.c, nuke it. 2008-08-25 21:24:07 +00:00
martin 11a6dbe728 Convert TNF licenses to new 2 clause variant 2008-04-30 13:10:46 +00:00
christos cb9daf8f10 cleanup:
- remove __P
	- remove unneeded casts
	- add _DIAGASSERT
	- add more diagnostics for integer overflow
	- fix size_t/int confusion
	- make debugging and statistics code compile
2007-02-03 23:46:09 +00:00
christos 95c7627c87 use FD_CLOEXEC instead of 1. 2006-11-03 20:18:49 +00:00
rtr b3c940abb1 set close-on-exec flag for fd to database like type DB_HASH does
approved by christos@
2006-03-26 02:03:40 +00:00
rtr 8c8b6ee256 make __hash_open obey TMPDIR
resolves pr32565 and pr32454
2006-03-26 02:00:37 +00:00
rtr 03c7830389 retrun -> return 2006-03-19 03:36:28 +00:00
christos 8a45d1a675 Coverity CID 45: Don't try to deref NULL on error. 2006-03-19 02:30:52 +00:00
christos 854b420cd9 Coverity CID 518: Avoid NULL pointer deref. 2006-03-19 02:21:15 +00:00
christos 53cd70b68b Coverity CID 508: Avoid memory leak. 2006-03-19 02:09:44 +00:00
christos 096020da19 fix debugging memsets. 2006-01-24 17:37:05 +00:00
christos a3ae551d7e simplify assertion. 2006-01-24 17:35:33 +00:00
christos ec567cd38c appease lint and gcc. (compile with -DDEBUG) 2006-01-24 17:24:37 +00:00
perry fd18408b9a u_intN_t -> uintN_t 2005-12-26 19:40:14 +00:00
christos 03256c6e55 WARNS=4 2005-11-29 03:11:58 +00:00
christos 76854df72e Initialize a variable that might confuse gcc as uninitialized. 2005-10-16 02:39:20 +00:00
christos 5b84b3983f compat core reorg. 2005-09-13 01:44:08 +00:00
lukem 63246b1ef4 Ensure dbp is initialized to NULL before trying to use it in an error codepath.
Detected with gcc -Wuninitialized.
(The bug was introduced in rev 1.13.  Hi Mycroft! :)
2005-06-01 05:39:17 +00:00
christos 340e17eb3b Don't attempt to delete a NULL key. Can happen if we were the only key
in a 64K page. Thanks to Juergen Hannken-Illjes for the test.
2005-04-27 23:11:29 +00:00
christos c4e3c4d493 Don't refuse to create a hash database on 0 length files. Treat
them as new files the same way that the btree code does.  Note that
we do the fstat() after the open() instead of re-using the previous
result of the stat() to avoid races (we open with O_EXLOCK when we care).
2005-03-29 23:37:15 +00:00
christos bab13a9d96 Revert previous commit at 1.17. a maximum BSIZE of 65536 ends up stored
as a 0 in the page, but it is supported and it does work.
2005-03-06 03:42:14 +00:00
mycroft b7e6351cc4 hash already uses FD_CLOEXEC -- pay attention to the return value and make it
a hard failure.

Also make btree and recno uses FD_CLOEXEC.
2005-01-19 00:23:44 +00:00
uwe e8d7ac57c1 Add missing .Ed reported by new mdoc. 2004-08-31 17:11:33 +00:00
jmc b2f782612f Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
2004-06-20 22:20:14 +00:00
wiz 3a6d7bd8c0 Revert part of previous.
[Never argue with a language lawyer, or at least expect to lose ;)]
2004-05-06 19:16:32 +00:00
wiz 7383a5157d Make that NULL, and mark up an extension like a path. 2004-05-01 07:59:09 +00:00
kleink 88d9244df3 Add ndbm(3) documentation, fixing PR lib/25357. 2004-04-30 21:13:23 +00:00
kleink ceeaed078c XPG4.2: when it is attempted to open a database write-only, silently
"upgrade" to use read/write access on the database file.
2004-04-29 18:37:20 +00:00
kleink b4e89dd2ab Purge a leftover comment from rev. 1.6. 2004-04-29 16:33:20 +00:00
kleink dbfbef898d XPG4.2: Change member `dsize' of struct datum from int to size_t.
Version dbm_{delete,fetch,firstkey,nextkey,store}() accordingly.
Fixes PRs standards/21402 from Ben Harris and standards/25343 from
Murray Armfield.
2004-04-28 00:10:52 +00:00
kleink 537be69d5c Remove internal names for dbm_*(3); these are not required at this time. 2004-04-27 20:03:45 +00:00
martin 9f96807631 When storing data size as 32bit int in an overflow page, copy the
length to a temporary u_int32_t variable and memmove from there to the
final destination - instead of copying the first four 0 bytes from a
64bit variable directly on big endian 64 bit platforms.

This makes sparc64 pass regress/lib/libc/db.
2003-12-30 21:20:16 +00:00
lukem 171d653219 Overhaul how `build.sh tools' are used:
*	Rename "config.h" to "nbtool_config.h" and
	HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
	This makes in more obvious in the source when we're using
	tools/compat/config.h versus "standard autoconf" config.h

    *	Consistently move the inclusion of nbtool_config.h to before
    	<sys/cdefs.h> so that the former can provide __RCSID() (et al),
    	and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
	#if HAVE_NBTOOL_CONFIG_H
	#include "nbtool_config.h"
	#endif
to the top of the source files (for the general case).
2003-10-27 00:12:41 +00:00
agc eb7c1594f1 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22280, verified by myself.
2003-08-07 16:42:00 +00:00
wiz aeeb4fe3d0 Grammar, spelling, markup fixes from jmc@openbsd. 2003-06-06 13:42:49 +00:00