dg [Thu, 25 Dec 1997 06:57:36 +0000 (06:57 +0000)]
The spl fixes in in_setsockaddr and in_setpeeraddr that were meant to
fix PR#3618 weren't sufficient since malloc() can block - allowing the
net interrupts in and leading to the same problem mentioned in the
PR (a panic). The order of operations has been changed so that this
is no longer a problem.
Needs to be brought into the 2.2.x branch.
PR: 3618
ache [Wed, 24 Dec 1997 23:23:18 +0000 (23:23 +0000)]
1) Restore back comment about snprintf()
2) Optimize string buffer copy to call memcpy() and update pointers
only for count > 0, it makes snprintf(NULL, 0, ...) more efficient
ache [Wed, 24 Dec 1997 23:02:47 +0000 (23:02 +0000)]
Return back to BSD snprintf semantics which recent C9x standard adopts
instead of Singe Unix, thanx Bruce for explaining, I am not realize
standards war was there.
But now, fix n == 0 case to not return error and fix check for too
big n.
Things left to do: check for overflow in arguments.
ache [Wed, 24 Dec 1997 20:24:08 +0000 (20:24 +0000)]
1) Oops! Insert again if (n == 0) return 0.
Final word is Bruce's quote:
C9x specifies the BSD4.4-Lite behaviour:
[#3] ... Thus, the
null-terminated output has been completely written if and
only if the returned value is less than n.
It means that if we not have any null-terminated output as for n == 0
we can't return value less than n, so we forced to return value
equal to n i.e. 0
The next good thing is glibc compatibility, of course.
2) Do check for too big n in machine-independent way.
3) Minor optimization assuming EOF is < 0
ache [Wed, 24 Dec 1997 14:32:40 +0000 (14:32 +0000)]
Back out part related to "return 0 if n == 0" and return EOF as before.
The main argument is that it is impossible to determine if %n evaluated or not
when snprintf return 0, because it can happens for both n == 0 and n == 1.
Although EOF here is good indication of the end of process, if n is
decreased in the loop...
Since it is already supposed in many places that EOF *is* negative, f.e.
from Single Unix specs for snprintf
"return ... a negative value if an output error was encountered"
this not makes situation worse.
ache [Wed, 24 Dec 1997 13:47:13 +0000 (13:47 +0000)]
Fix snprintf(...%n...)
to pass not more than buffer size to %n agrument, old variant
always assume infinite buffer.
%n is for actually transmitted characters, not for planned ones.
ache [Wed, 24 Dec 1997 12:31:32 +0000 (12:31 +0000)]
snprintf return value fixes to conform Single Unix specs:
1) if buffer size is smaller than arguments size, return buffer
size, not arguments size as before.
2) if buffer size is 0, return 0, not EOF as before.
(now it is compatible with Linux and Apache implementations too).
NOTE: Single Unix specs says:
If the value of n {buffer size} is zero on a call to snprintf(), an
unspecified value less than 1 is returned.
It means we can't return EOF since EOF can take *any* value in general
not especially < 1. Better variant will be return -1 (it is less then
1 and different with n == 1 case) but -1 value is already occuped by
EOF in our implementation, so we can't distinguish true IO error
in that case. So 0 here is only possible case still conforming
to Single Unix specs.
nate [Tue, 23 Dec 1997 16:32:35 +0000 (16:32 +0000)]
This patch causes the "calltodo" timer list to be decremented by the amount
of time that the laptop was suspending. Thus, select() calls that might have
suspended rather than firing at 1hr + "time suspended" since the timer was
posted.
Adding:
options APM_FIXUP_CALLTODO
to the kernel config enables the patch.
[
This patch was slightly modified to use a consistant indent style and
I removed some unused local variables. After this has been tested a
few weeks we'll make the options the default, so for now I'm now
documenting it in LINT. Mike can later if he wants.
]
Reviewed by: Mike Smith <msmith@freebsd.org>
Submitted by: Ken Key <key@cs.utk.edu>
yokota [Tue, 23 Dec 1997 08:04:38 +0000 (08:04 +0000)]
- Added support for a new MouseMan model (4 buttons, no wheel).
Based on the report from Dave Bodenstab.
- Turn off PnP COM device enumeration procedure if the user explicitly
specifies a protocol type with the "-t" option.
- Accept "-t auto". Now the user may entirely omit the "-t" option
in the command line, or specify "-t auto" in order to make moused
detect an appropriate protocol type automatically. In the
previous version, moused did so only if the "-t" option is absent
in the command line. ("-t auto" won't disable PnP COM device
enumeration.)
- Updated the man page.
jb [Mon, 22 Dec 1997 19:39:20 +0000 (19:39 +0000)]
Reviewed by: William LeFebvre <wnl@groupsys.com>
Change errno -> error in local structure to avoid a clash with the
thread-aware version of errno which is required for a thread-safe libc.
Have discussed this with the author and he has agreed to this change. 8-)
joerg [Sun, 21 Dec 1997 21:40:02 +0000 (21:40 +0000)]
Properly clean out the SI_MOUNTEDON flag iff the mount attempt fails
half the way down. Otherwise, further attempts to mount the device
will be rejected with BUSY.
IMHO, this flag can completely go away for cd9660. There's no reason
you need to prevent CDs from being mounted multiple times, and in case
of multisession CDs it can even make sense to mount two different
sessions by the same time (to different mount points, otherwise it
would be pointless ;).
bde [Sun, 21 Dec 1997 00:00:44 +0000 (00:00 +0000)]
Fixed overflow in chkrange(). Some out of bounds block numbers,
e.g. -1, were not detected. Use a bulletproof check that doesn't
depend on special properties of the args or the limit.
joerg [Sat, 20 Dec 1997 23:05:14 +0000 (23:05 +0000)]
Duplicate the entry for the Plasmon CD-R device, so both possibilities
(read/only and write/once) will be covered. This is necessary in order
to fill in the proper device information record.
joerg [Sat, 20 Dec 1997 23:03:49 +0000 (23:03 +0000)]
Protect against a null pointer dereferencation in the case of an
unknown drive. Such a drive will be configured by worm(4)
nevertheless (albeit with a warning), but cannot be opened except of
the SCSI control device (so scsi(8) or cdrecord will continue to
work).
bde [Sat, 20 Dec 1997 22:24:32 +0000 (22:24 +0000)]
Fixed style bugs in the printing of statistics after preening. Use
floating point better in the percentage calculation there to avoid
overflow when there are more than about 20 million fragments. Start
using floating point in the other percentage calculation to avoid
overflow when there are more than about 2 million fragments.
bde [Sat, 20 Dec 1997 21:36:58 +0000 (21:36 +0000)]
Don't attempt to print the statistics for a "clean" preened filesystem
when there isn't even a filesystem. Attempting to print them tended
to cause SIGSEGV or SIGFPE depending on how far setup() got before it
returned 0. This was broken in the previous revision by removing a
return statement that the previous case depended on falling into.
PR: 4840 (fixed by this commit)
PR: 2537 (possibly fixed by Lite2 merge and later changes. setup()
does more checking now)
wosch [Sat, 20 Dec 1997 18:46:09 +0000 (18:46 +0000)]
Added builtin decompression using zlib library, option -Z.
Enabled this new feature with the makefile variable GREP_LIBZ. If
you don't like it, compile with `make GREP_LIBZ='.
grep + zlib has several advantages:
- the shell script zgrep(1) will be basically a one line
exec grep -Z "$@"
- no shell script, no bugs. The current zgrep implementations
have many bugs and some grep options are no supported.
- no shell script, no security risks.
- it is a magnitude faster than a shell script
Also fixed:
0 -> STDIN_FILENO
Close a file descriptor only if the open call was successfully. It does
not hurt for the open(2) function, but the gzclose(3) function
died in free() to free up (not) allocated memory.
se [Sat, 20 Dec 1997 09:04:25 +0000 (09:04 +0000)]
Make the class code checks in function pci_cfgcheck less strict.
It failed to recognize the PCI bus in a system that had only an
old chip-set (class code 000000) and a Cyclom multiport serial
card on PCI bus 0, but no VGA card or disk or network controller.
PR: i386/5300
Submitted by: Nickolay N. Dudorov <nnd@itfs.nsk.su>
jb [Sat, 20 Dec 1997 04:06:06 +0000 (04:06 +0000)]
Change errno usage as a field in a structure and as an argument to a
function from 'errno' to 'error' so that there is no conflict with the
thread-safe definition of errno in errno.h.
sef [Sat, 20 Dec 1997 03:05:47 +0000 (03:05 +0000)]
Clear the p_stops field on change of user/group id, unless the correct
flag is set in the p_pfsflags field. This, essentially, prevents an SUID
proram from hanging after being traced. (E.g., "truss /usr/bin/rlogin" would
fail, but leave rlogin in a stopevent state.) Yet another case where procctl
is (hopefully ;)) no longer needed in the general case.
bde [Sat, 20 Dec 1997 00:40:05 +0000 (00:40 +0000)]
Never create the destination directory at install time.
Don't build things at install time.
Don't override the (correct) clean rule.
Rewrote all the rules and cleaned up.
bde [Fri, 19 Dec 1997 23:33:08 +0000 (23:33 +0000)]
Removed a stale comment. (We don't declare ip_len and ip_offset as
short. I guess we depend on bogus ANSI value-preserving extension
of u_short to int to avoid unsigned comparison bugs.)
bde [Fri, 19 Dec 1997 22:11:29 +0000 (22:11 +0000)]
Fixed the termcap 3.0 hacks. They were very broken in my configuration
where shared libraries are in /lib and almost everything is linked
shared. First, they removed the old shared library before installing
the new one. Second, they attemped a cross-device link from /lib
to /usr/lib/compat.