Warner Losh [Tue, 9 Jun 1998 05:06:27 +0000 (05:06 +0000)]
If we get back too much data to fit in result, return NULL. This avoids
a buffer overflow, but might negatively impact those hosts who have
enough aliases to fill MAXHOSTNAMELEN * 2 characters in them.
Good candidate for merging back into -stable. Lightly tested by me, but
it came from OpenBSD a while ago.
Warner Losh [Tue, 9 Jun 1998 04:28:05 +0000 (04:28 +0000)]
o Use snprintf rather than sprintf.
o Revert gid to caller before a shell so we can run setgid.
o minor style nits to make bruce happy :-)
o use strncpy correctly.
Warner Losh [Tue, 9 Jun 1998 04:20:51 +0000 (04:20 +0000)]
Use mkstemp rather than mktemp for yacc's temp files. This change was made
to OpenBSD a long time ago and to my tree shortly thereafter. I think theo
made this change, or one similar to it, but I could be wrong.
Warner Losh [Tue, 9 Jun 1998 04:17:29 +0000 (04:17 +0000)]
o Use snprintf rather than sprintf
o Add more checks for buffer overflows
o Use snprintf rather than strcat/cpy and have better checks for max
length exceeded.
Most of these changes are not exploitable buffer overruns, but it never
hurts to be safe.
Warner Losh [Tue, 9 Jun 1998 03:38:43 +0000 (03:38 +0000)]
Make sure we pass the length - 1 to readlink, since it adds its own
NUL at the end of the path.
Inspired by: OpenBSD's changes in this area by theo de raadt
Bruce Evans [Tue, 9 Jun 1998 03:32:05 +0000 (03:32 +0000)]
Don't generate COMPAT_43 cruft if there are no COMPAT_43 syscalls.
In particular, don't generate an include of "opt_compat.h" if it
wouldn't affect anything we create. This will fix recent breakage
of the ibcs2 LKM. The ibcs2 syscall files were not regenerated
properly, so the LKM didn't break immediately when we started
generating this extraneous include.
Bruce Evans [Tue, 9 Jun 1998 02:55:40 +0000 (02:55 +0000)]
Fixed `make depend', which I broke here about a month ago by moving
the null default for `depend' from bsd.dep.mk to bsd.obj.mk.
bsd.kmod.mk included these files in a bad order, so it picked up
the null default.
Julian Elischer [Mon, 8 Jun 1998 23:55:33 +0000 (23:55 +0000)]
The version of the softdep changes in FreeBSD broke the
(doingdirectory && !newparent) case of ufs_rename().
rename("D1/X/", "D2/Y/") gives a wrong link count for D2.
Submitted by: Bruce Evans <bde@zeta.org.au>
Reviewed by: Kirk McKusick <mckusick@McKusick.COM>
Brian Somers [Mon, 8 Jun 1998 20:23:44 +0000 (20:23 +0000)]
Correct ``set server'' usage and add mention that ``set ns'' changed
in README.changes.
Suggested by: stuart henderson <stuart@internationalschool.co.uk>
Bruce Evans [Mon, 8 Jun 1998 09:47:47 +0000 (09:47 +0000)]
Fixed pedantic semantics errors (bitfields not of type int, signed int
or unsigned int (this doesn't change the struct layout, size or
alignment in any of the files changed in this commit, at least for
gcc on i386's. Using bitfields of type u_char may affect size and
alignment but not packing)).
Bruce Evans [Mon, 8 Jun 1998 08:50:43 +0000 (08:50 +0000)]
Fixed pedantic semantics errors (bitfields not of type int, signed int
or unsigned int (don't do this in one case where it would change the
object file)).
Bruce Evans [Mon, 8 Jun 1998 06:04:12 +0000 (06:04 +0000)]
ip_fil.h has 9 separate declarations of iplioctl() in a disgusting
ifdef tangle. The previous commit to ip_fil.h didn't change the
one that actually applies to the current FreeBSD kernel, of course.
Fixed.
John Polstra [Sun, 7 Jun 1998 21:53:01 +0000 (21:53 +0000)]
Speed up the cleaning of CHROOTDIR by almost a factor of two, by
replacing two monstrous file tree walks with one monstrous tree walk
and two miniscule ones.
Add a member function more to the timecounters, this one is for use
with latch based PPS implementations. The client that uses it will
be committed after more testing.
Doug Rabson [Sun, 7 Jun 1998 17:13:14 +0000 (17:13 +0000)]
This commit fixes various 64bit portability problems required for
FreeBSD/alpha. The most significant item is to change the command
argument to ioctl functions from int to u_long. This change brings us
inline with various other BSD versions. Driver writers may like to
use (__FreeBSD_version == 300003) to detect this change.
The prototype FreeBSD/alpha machdep will follow in a couple of days
time.
Bruce Evans [Sun, 7 Jun 1998 11:04:26 +0000 (11:04 +0000)]
Null change. Forgot to mention in previous log message that MNT_NOATIME
is now ignored for special files, so that mounting root with option
noatime doesn't break reporting of idle times in programs like `w'.
The problem of execessive disk updates just to stamp atimes will be
handled for special files by only writing atimes to disk when inodes
become active. This works well because special files are relatively
uncommon and their atimes are even more disposable at panic time than
regular files' atimes.
Bruce Evans [Sun, 7 Jun 1998 10:49:18 +0000 (10:49 +0000)]
Fixed some longstanding timestamp bugs:
1. mark atimes and mtimes of special files and fifos for update upon
successful completion of non-null i/o, not at the beginning of the
syscall.
2. never update file times for readonly filesystems. They were updated
for stats and closes but not for syncs. The updates were of course
only in-core and were thrown away when the inode was uncached, so
the times sometimes appeared to go backwards.
Improved comments in code related to (1) (mostly by removing them).
Unmacroized ITIMES(). The test in (2) bloated it even more. Don't
call getmicrotime() in the function version of it when we only need
the time in seconds.
Brian Somers [Sun, 7 Jun 1998 03:53:08 +0000 (03:53 +0000)]
Search for libraries in dlopen() when the specified path
contains no ``/''s.
Elf already searches it seems.
Mostly submitted by: Mike Smith <mike@smith.net.au>
John Birrell [Sat, 6 Jun 1998 07:24:24 +0000 (07:24 +0000)]
Simplify the handling of thread specific data. Only track if a key
is allocated or not, rather than keeping a count and attempting to
know it it is in-use. POSIX says that once a key is deleted, using the
key again results in undefined behaviour.
Bruce Evans [Sat, 6 Jun 1998 03:06:55 +0000 (03:06 +0000)]
Don't attempt to copy the whole slices "struct" for DIOCGSLICEINFO.
The slices "struct" isn't really a struct; we allocate only part of
it in the fully dangerously dedicated case. Since the "struct" is
malloced, the page beyond it may not be mapped, so attempts to copy
it would crash. This problem became larger when the full struct was
bloated from < 1K to > 3K by the addition of (mostly unused) DEVFS
tokens some time before 2.2.0 was released.
Bruce Evans [Sat, 6 Jun 1998 01:13:21 +0000 (01:13 +0000)]
Don't run the target's ldconfig or build it as a tool. If target == host
(in particular, if DESTDIR is empty or "/"), then the host's ldconfig will
be the target's ldconfig by the time it is run.
Fixed disordering of env.
Don't know too much about libcrypt. Use exactly the same definition of
_libcrypt as lib/Makefile.
Bruce Evans [Sat, 6 Jun 1998 00:56:23 +0000 (00:56 +0000)]
Fixed bogotification of the lex bootstrap in rev.1.186 and the previous
commit - don't wander off to bootstrap mtree and include in the middle
of bootstrapping lex, and don't forget what we were doing and build
some lex obj dirs twice.
Julian Elischer [Fri, 5 Jun 1998 23:33:26 +0000 (23:33 +0000)]
Reviewed by: Kirk Mckusick (mckusick@mckusick.com)
Submitted by: luoqi Chen
fix a type in fsck.
(also add a comment that got picked up by mistake but is worth adding)