Commit Graph

58 Commits

Author SHA1 Message Date
shm 6f4b1613b1 Fix memory leak in getent()
Memory was not freed if record was not found
2023-09-21 13:46:12 +00:00
manu 6a05c304af Make shared -DSMALL libc buildable without breaking libhack
We used -DSMALL to exclude code from libc in order to build
libhack. Introduce -DLIBHACK to do this without so that
-DSMALL does not remove code necessary for building a shared libc
2017-06-18 03:56:39 +00:00
christos 9d26a6478d undo, the right place for this is compat_defs.h 2014-09-24 13:18:52 +00:00
he fce45f5a15 Provide a backward-compatible conditional define of O_CLOEXEC
for those systems which lack it, since these files are used in
tools builds.
2014-09-24 07:53:06 +00:00
christos 9a513d9643 make more descriptors that we open as close-on-exec 2014-09-18 13:58:20 +00:00
christos 321c9aef65 don't depend on expandtc to open the database or not. 2014-06-26 20:14:32 +00:00
joerg 02682f7d23 ANSIfy 2012-06-04 20:56:40 +00:00
christos c5e820cae4 PR/45989: Martin Husemann: lint invocation does include -w only on i386
- turn lint -w for all the platforms after fixing the lint warnings.
- add _DIAGASSERTS() for casts that would assign values to types that
  would not fit.
- change types, add casts
- change into ansii prototypes
- turn on _DIAGNOSTIC for libc (during current, to be eliminated for release
  builds)

approved by core@
2012-03-13 21:13:30 +00:00
christos 9292cfb210 close on exec fixes:
- open + fcntl -> open O_CLOEXEC
- configuration database file descriptors that can stay open are now opened
  fopen(db, "re")
2011-10-15 23:00:01 +00:00
joerg 2c39cf5f91 Don't define weak aliases in the SMALL case. They conflict with the real
function name since SMALL doesn't use the normal rename logic.
2011-02-07 21:39:47 +00:00
christos 0d149bc5fe Add csetexpandtc() 2008-02-02 20:56:46 +00:00
jnemeth 787fd08293 KNF 2006-07-04 03:53:54 +00:00
jnemeth d7635ff0b0 missed check for malloc() returning NULL 2006-05-29 21:55:41 +00:00
christos e9427c25f6 Add coverity annotations. 2006-04-02 03:26:03 +00:00
christos dfd5a33604 Coveriry CID 509: Avoid NULL pointer deref. 2006-03-19 02:25:12 +00:00
christos 10a8cb0e88 Coverity CID 510: Avoid uninitialized variable. 2006-03-19 02:12:09 +00:00
christos 03256c6e55 WARNS=4 2005-11-29 03:11:58 +00:00
christos 0b1d0cb383 Add -DSMALL so that this can be used in libhack. 2004-04-25 06:45:29 +00:00
christos 2bab61681c Ansify and add change db_name vector from char ** to const char * const * 2004-04-23 14:47:52 +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
uwe 4eb408dcd9 Avoid cgetcap &co prototypes conflicting with those provided by the host.
With this change we can cross-compile on FreeBSD 4.x.
2003-01-31 20:50:29 +00:00
tron 2f9d1834f5 Include "sys/param.h" and use "MATHPATHLEN" instead of "_POSIX_PATH_MAX"
to fix build problem.
2002-08-04 11:55:51 +00:00
groo f74c26e49b Detect if line length exceeds buffer capacities.
from xs@kittenz.org
2002-04-16 19:07:57 +00:00
mrg 5812b2fe67 avoid an underrun in "buf". noted by dean@huxley.org in PR#13292 2001-06-25 15:34:08 +00:00
itojun 74d0ceb979 correct memory leak due to t_getstr() and realloc(). the commit will
prevent "top -s 0" from chewing up memory.

TODO: realloc() audit, revisit recent termcap/curses changes
2000-06-02 13:13:07 +00:00
mycroft 605490369c Delint.
Remove trailing ; from uses of __weak_alias().  The macro inserts this if
needed.
2000-01-22 22:19:07 +00:00
lukem d896261208 back out the #ifdef _DIAGNOSTIC argument checks; too many people complained.
_DIAGASSERT() is still retained.
1999-09-20 04:38:56 +00:00
lukem b48252f365 * use _DIAGASSERT() to check pointer arguments against NULL and file
descriptors against -1 (as appropriate).
* add actual checks which to detect stuff that would trigger_DIAGASSERT(),
  and attempt to return a sane error condition.
* knf some code
* remove some `register' decls.

the first two items result in the addition of code similar to the
following in various functions:

		_DIAGASSERT(path != NULL)
	#ifdef _DIAGNOSTIC
		if (path == NULL) {
			errno = EFAULT;
			return (-1);
		}
	#endif
1999-09-16 11:44:54 +00:00
abs ac83f64eca Cast argument to isspace to (unsigned char) to pass zoularis. 1999-03-29 09:27:29 +00:00
abs 5e69f8317f Fix 'suggest parentheses' warning noted by Erik E. Fair <fair@clock.org> 1999-03-23 02:58:50 +00:00
abs 6c70403fe8 If we push a cap entry (usually from the environment), strip : deliminated
entries that only contain whitespace, in a similar fashion to reading from
a file.
1999-03-22 03:28:09 +00:00
christos 3eeda4afc6 Fix gcc-2.8.1 warnings. 1999-03-16 18:13:44 +00:00
christos 920a51d98f avoid assignment of a read only location that lint does not pick, but gcc does. 1998-11-13 08:25:17 +00:00
christos ce52ab49cb delint 1998-11-12 16:25:21 +00:00
perry 98b9f211ee fix bcopy->memcpy with memcpy->memmove -- not strictly needed, but... 1998-08-26 00:38:39 +00:00
perry a843f0f8a5 bzero->memset, bcopy->memcpy, bcmp->memcmp 1998-08-10 02:43:08 +00:00
mycroft f9f7e98dab const poisoning. 1998-07-27 07:41:31 +00:00
mycroft b3b504b51a Suppress blank fields due to continuation lines. 1998-07-21 13:36:54 +00:00
tv 902d175a04 PR 5170: don't fclose twice, or call ferror after fclose.
required removing fcloses and/or moving them, nulling the pointers
like they should have been, and adding a terminating null byte and break
in one case (perhaps we never ran into those problems before).
cgetclose() already does a fclose and null of the pointer, so don't
duplicate it when we don't need to.
1998-03-18 20:29:27 +00:00
thorpej 669c5bea18 Fix type size lossage on the Alpha. 1998-03-02 23:39:49 +00:00
perry 1ea84adf39 trivial changes to reduce lint complaints 1998-02-26 02:40:11 +00:00
perry 4146d58604 remove obsolete register declarations 1998-02-03 18:23:37 +00:00
kleink 66105c37fc Lseek(2) usage cleanup: the use of L_SET/L_INCR/L_XTND is deprecated,
use SEEK_SET/SEEK_CUR/SEEK_END instead.
1997-08-25 19:31:43 +00:00
jtc 43fa6fe319 If port provides __weak_alias(), provide an Standard C and POSIX pure
identifier namespace by renaming non standard functions and variables
such that they have a leading underscore.  The library will use those
names internally.  Weak aliases are used to provide the original names
to the API.

This is only the first part of this change.  It is most of the functions
which are implemented in C for all NetBSD ports.  Subsequent changes are
to add the same support to the remaining C files, to assembly files, and
to the automagically generated assembly source used for system calls.
When all of the above is done, ports with weak alias support should add
a definition for __weak_alias to <sys/cdefs.h>.
1997-07-21 14:06:24 +00:00
christos d177cac3ba Fix RCSID's
Fix gcc warnings.
1997-07-13 19:00:13 +00:00
pk 58efb9d20c NULL => 0 (Arne Juul; PR#3629) 1997-05-17 19:24:44 +00:00
mrg 9cd5492c02 - convert unsafe strcpy(), strcat() and sprintf() to the `n' versions.
- some KNF.
1997-01-23 14:01:45 +00:00
mycroft ce6374e6be Do not terminate the search on errors other than ENOENT. 1995-08-24 05:26:35 +00:00
cgd 6e6a4e85b0 update to 4.4-Lite where appropriate, clean up Id format, etc. 1995-02-25 13:40:51 +00:00