Commit Graph

1441 Commits

Author SHA1 Message Date
Peter Wemm
86854f0360 A feeble attempt at kld compatability. The mount_* programs assume that
they cannot mount a filesystem that they cannot see in getvfsbyname().
Part 1 of this is a hack, make vfsisloadable() always return true - the
ultimate decider of whether it's loadable or not is kldload() or mount().
Part 2 of this is to have vfsload() call kldload(2) and return success if
it works.  This means that we will use a viable kld module in preference
to an LKM!
Ultimately, the thing to do is remove the hacks to do a vfsload in all the
mount_* commands and let the kernel do it by itself in mount(2).
1998-11-03 15:02:29 +00:00
Jean-Marc Zucconi
65f14a74bd Typo. 1998-10-30 23:50:48 +00:00
Mike Smith
ebed2088fe Prevent buffer overflow in getpwnam()
PR:		bin/8176
Submitted by:	Archie Cobbs <archie@whistle.com>
1998-10-29 23:16:24 +00:00
Robert Nordier
30af884929 Clarify processing of the string argument by psignal(). 1998-10-29 22:17:46 +00:00
Robert Nordier
4a3bc52a9c (Whoops: make it better instead of worse this time). Clarify
processing of the string argument by perror().
1998-10-29 22:08:59 +00:00
Robert Nordier
94cc971811 Clarify processing of the string argument by perror(). 1998-10-29 21:59:38 +00:00
Robert Nordier
e524a581b1 Check for a zero-length as well as a NULL string argument. 1998-10-29 14:40:20 +00:00
Robert Nordier
d223b5868e The man page implies that the string argument to psignal() may be
NULL, in line with perror(3).  However, the code presently checks only
for a zero-length string.  Check for both.
1998-10-29 11:39:39 +00:00
John Polstra
76a2643efb Handle ELF symbols better. This fixes "vmstat -i" for the case
where "/var/db/kvm_kernel.db" doesn't exist.
1998-10-28 06:37:49 +00:00
Bill Fenner
551677729e ('): and ('); -> (:') and (;') 1998-10-26 19:36:38 +00:00
David E. O'Brien
2100aed918 Slight style police.
Add some content from objformat(1).
1998-10-25 13:29:57 +00:00
Andrey A. Chernov
a4beee718b fix unsigned overflow
PR: 8437
1998-10-25 05:06:42 +00:00
Dima Ruban
964b832929 Fix types. 1998-10-21 09:48:35 +00:00
Peter Wemm
ed1bbda829 Revert last change. mkstemp() wasn't to blame, it's nvi. However,
mkstemp() is not behaving as documented.
1998-10-20 15:33:21 +00:00
Peter Wemm
eb356f9af0 Stop mk*temp() from being pathologically stupid in the face of a umask(0);
There are other ways to fix this than wrapping _gettemp(), but this was
the most convenient.

Discovered by: bde
1998-10-20 12:36:36 +00:00
Dag-Erling Smørgrav
af806462dc Fix style issues in execl(), and make execle() vfork()-safe.
Reviewed by:	bde
Approved by:	jkh
1998-10-15 17:14:15 +00:00
Mike Smith
26c51fb453 Conform to POSIX and close any copies of popen() descriptors inherited by a
popen()ed child.

PR:		misc/7810
Submitted by:	Wayne Scott <wscott@ichips.intel.com>
1998-10-15 01:47:40 +00:00
Dag-Erling Smørgrav
7ea577e550 Correct braino in previous commit. I get the pointy hat again. 1998-10-14 20:23:40 +00:00
Dag-Erling Smørgrav
dea625c872 Make execl() vfork()-safe. This should fix potential bugs in rcp,
telnet and tip, and probably a few other apps.

Reviewed by:	bde
Approved by:	jkh
1998-10-14 18:53:36 +00:00
Peter Wemm
0c372549f6 Avoid the need for calling functions that malloc after a vfork(). 1998-10-11 14:11:51 +00:00
Bruce Evans
0890dc6f44 vfork -> fork. The child calls execl() which calls malloc(), so
vfork() can't be used.  We could use alloca() in execl() so that
it can be called between vfork() and execve(), but a "portable"
popen() shouldn't depend on this.  Calling execle() instead of
execl() should be fairly safe, since execle() is supposed to be
callable from signal handlers and signal handlers can't call
malloc().  However, execle() is broken.
1998-10-10 19:30:45 +00:00
Eivind Eklund
b41c848d46 Remove the description of EBADF (that's an implementation detail if I
ever saw one), and move the description of NULL behaviour out to a
'NOTES' section, with an extra note that programs should not rely up
on it.

Kinda-approve-by:	bde (by not replying to the mail with the diff)
1998-10-10 13:31:32 +00:00
Julian Elischer
29595ffd90 Fix a memory leak
PR: 7923
Submitted by: Archie Cobbs <archie@whistle.com>

        The scandir() function returns -1 if it fails.
	In many cases when this happens, it does not free
	the memory that it allocated, resulting in a memory
	leak, or close the directory opened with opendir().
	BAD DOG, BAD!
1998-10-07 01:30:02 +00:00
Doug Rabson
e0ce825e94 64bit portability fixes.
Submitted by: Andrew Gallatin <gallatin@cs.duke.edu>
1998-10-05 18:35:04 +00:00
Eivind Eklund
aef1f383cf program written under FreeBSD -> programs written under FreeBSD
Noticed by:	Alex Nash <nash@mcs.net>
1998-10-03 16:17:30 +00:00
John Birrell
a0aa389007 Delete the XXX comments that refer to spinlock recursion. The malloc/free/
realloc functions check for recursion within the malloc code itself. In
a thread-safe library, the single spinlock ensures that no two threads
go inside the protected code at the same time. The thread implementation
is responsible for ensuring that the spinlock does in fact protect malloc.
There was a window of opportunity in which this was not the case. I'll fix
that with a commit RSN.
1998-09-30 06:13:59 +00:00
Joseph Koshy
7669e9013b `kern.maxproc' is not changeable from sysctl(8).
Reminded by:	Bruce Evans <bde@zeta.org.au>
1998-09-29 05:16:45 +00:00
Eivind Eklund
8bd4c21699 Document that we will core-dump on getting a NULL pointer. 1998-09-28 15:34:24 +00:00
Doug Rabson
f0a3692000 Don't cast int pointers to long pointers when reading labels from
/etc/disktab.
1998-09-26 14:44:06 +00:00
David E. O'Brien
5846581c2e Apply patch to properly sscanf(3) when there is whitespace in the format
string.  From the submitted patch:

Credit for patch:	Chris Torek <torek@bsdi.com>
			Tod Miller  <millert@openbsd.org>

This makes us in line with SunOS 4.1.3_U1, Solaris 2.6, OpenBSD 2.3,
HP-UX 10.20, Irix 5.3.  The previous behavior was in line with Ultrix 4.4.

PR:		bin/7970
Submitted by:	Niall Smart nialls@euristix.ie
1998-09-25 12:20:27 +00:00
Doug Rabson
cea1d019fe Use 8k pagesize on alpha, not 4k. 1998-09-23 21:26:04 +00:00
Alexander Langer
d988805a1f Back out part of previous commit (even though it's technically correct).
Our spinlock implementation allows a particular thread to obtain a lock
multiple times, but release the lock with a single unlock call.  Since
we're detecting recursion, we know the lock is already owned by the
current thread in a previous call and must not be released in the
current call.  This is really far too dependent on this particular
spinlock implementation, so I've added commented out calls to
THREAD_UNLOCK in the appropriate places.  We can activate this code when
spinlock is taught to count each lock operation.
1998-09-20 01:07:50 +00:00
Alexander Langer
366248e086 Correctly back out of free if a recursive call into malloc.c is detected.
Set malloc_func *after* grabbing the thread lock.

Noticed by:	Simon Coggins <simon@oz.org>
1998-09-19 20:55:36 +00:00
Luoqi Chen
ae45749a50 Simplify implementation and eliminate a register preservation problem.
Reviewed by:	Bruce Evans <bde@zeta.org.au>
1998-09-18 05:50:52 +00:00
Poul-Henning Kamp
8d54281ce7 s/yellow pages/NIS/
PR:		7949
Reviewed by:	phk
Submitted by:	Norihiro Kumagai <kuma@jp.freebsd.org>
1998-09-17 08:29:16 +00:00
Joseph Koshy
0a843f2afb Sort table and descriptions.
Pointed out by: bde
1998-09-16 07:25:34 +00:00
Warner Losh
e8420087b0 Replace memory leaking instances of realloc with non-leaking reallocf.
In some cases replace if (a == null) a = malloc(x); else a =
realloc(a, x); with simple reallocf(a, x).  Per ANSI-C, this is
guaranteed to be the same thing.

I've been running these on my system here w/o ill effects for some
time.  However, the CTM-express is at part 6 of 34 for the CAM
changes, so I've not been able to do a build world with the CAM in the
tree with these changes.  Shouldn't impact anything, but...
1998-09-16 04:17:47 +00:00
Warner Losh
e70c6df958 o Don't reference non-existant function freealloc.
o Properly order things

Pointed out by: bde
1998-09-16 04:07:31 +00:00
Warner Losh
9a5722f2e8 Fix style problems noted by Bruce:
o No copyright on reallocf.
	o Order makefile list correctly.
	o indent reallocf properly.
1998-09-16 03:16:06 +00:00
Dmitrij Tejblum
b5acd0014e Don't initialize NIS until it is really necessary. Now, in case of network
or NIS server problems, local user can login without a pause.

Also, -Wsomething cleanup.
1998-09-15 16:22:30 +00:00
Joseph Koshy
61a4defd54 Turn off replies to ICMP echo requests for broadcast and multicast
addresses by default.

Add a knob "icmp_bmcastecho" to "rc.network" to allow this
behaviour to be controlled from "rc.conf".

Document the controlling sysctl variable "net.inet.icmp.bmcastecho"
in sysctl(3).

Reviewed by: dg, jkh
Reminded on -hackers by: Steinar Haug <sthaug@nethelp.no>
1998-09-15 10:49:03 +00:00
Garrett Wollman
75a21a3859 Replace accidentally-deleted `x' which caused warnx() to misbehave. 1998-09-15 01:49:32 +00:00
Joseph Koshy
6e2affc98f Correct a typo that I noticed. 1998-09-15 00:24:19 +00:00
Warner Losh
b8a328fc74 o use strncpy safely
o Only allow options and domain name to be set when we aren't running
  setuid.

Obtained from: OpenBSD
1998-09-14 21:13:06 +00:00
Warner Losh
94ad719cf4 Add reallocf to the library. This function is simliar to realloc, but
when it returns NULL to indicate failure, it will also free the memory
that was passed to it, if that was non-null.

This does not change the semantics of realloc.

A second commit will be done to commit the conversion of those places in
the code that can safely use this to avoid memory leaks when confronted
with low memory situations.

Beaten-to-death-but-finally-approved-in: -current
1998-09-14 20:34:34 +00:00
Luoqi Chen
02bc6ef2c8 Fix a cut 'n paste mistake. 1998-09-13 20:32:45 +00:00
Dmitrij Tejblum
deb9688ae1 In libc_r, rename vfork syscall to _thread_sys_vfork and make vfork an alias
to fork. It is difficult to do real vfork in libc_r, since almost every
operation with file descriptsor changes _thread_fd_table and friends.

popen(3) works much better with this change.
1998-09-12 22:03:20 +00:00
Garrett Wollman
48f4157055 Document the fact that shutdown(2) is expected to comply with Posix.1g,
when it happens.
1998-09-12 21:38:30 +00:00
Dmitrij Tejblum
f0cefaccae Change return type of strptime from const char* to char*.
const char* was wrong and nonstandard.
1998-09-12 21:13:29 +00:00
Garrett Wollman
b4b4fb871e A small last-minute iitem for 3.0:
- Fix some style errors I made back in 1995.

- Add a new flavor of the err(3) family, which takes an explicit
  errno argument rather than implicitly examining errno.  This
  will make it easier to use these functions in conjunction with
  modern library interfaces that return an errno value explicitly.
1998-09-12 21:02:22 +00:00