#
ace5b9b5 |
| 20-Jan-2024 |
christos <christos@NetBSD.org> |
Catch up with all the lint warnings since exit on warning was disabled. Disable 'missing header declaration' and 'nested extern' warnings for now.
|
#
f0c6c300 |
| 07-Feb-2021 |
jdolecek <jdolecek@NetBSD.org> |
restore change from rev 1.23 "Avoid undefined behavior in fread(3)", mistakely removed as part __SNBF optimization
|
#
715c666a |
| 01-Feb-2021 |
jdolecek <jdolecek@NetBSD.org> |
for fread(3) and fwrite(3) check for (size * nmemb) size_t overflow, and error out with EOVERFLOW if it happens; this is less silly answer to a silly call than returning some randomly wrapped length
for fread(3) and fwrite(3) check for (size * nmemb) size_t overflow, and error out with EOVERFLOW if it happens; this is less silly answer to a silly call than returning some randomly wrapped length
change adapted from OpenBSD
FreeBSD has a similar check, but they return EINVAL instead, feel free to adjust if SUS or other standard mandates specific value
suggested by Kamil Rytarowski
show more ...
|
#
87a4031a |
| 31-Jan-2021 |
jdolecek <jdolecek@NetBSD.org> |
for unbuffered I/O arrange for the destination buffer to be filled in one go, instead of triggering long series of 1 byte read(2)s; this speeds up fread() several order of magnitudes for this case, d
for unbuffered I/O arrange for the destination buffer to be filled in one go, instead of triggering long series of 1 byte read(2)s; this speeds up fread() several order of magnitudes for this case, directly proportional to the size of the supplied buffer
change adapted from OpenBSD rev. 1.19
fixes PR lib/55808 by Roland Illig
show more ...
|
#
6f201b68 |
| 22-Feb-2020 |
kamil <kamil@NetBSD.org> |
Avoid undefined behavior in fread(3)
On the first call to fread(3), just after fopen(3) the internal buffers are empty. This means that _r and _p (among others) are zeroed.
Passing NULL to the 2nd
Avoid undefined behavior in fread(3)
On the first call to fread(3), just after fopen(3) the internal buffers are empty. This means that _r and _p (among others) are zeroed.
Passing NULL to the 2nd argument of memcpy(3) for the zero length is undefined. Calling _p += 0 triggers LLVM UBSan (NULL pointer arithmetic). Calling _p += 0, p += 0 and resid -= 0 has no effect.
Replace the "fp->_r = 0;" logic with a short circuit jump to __srefill() that sets _r internally and refills the FILE buffers.
No functional change from an end user point of view, except skipping a few dummy operations on the first call, for a FILE pointer, to fread(3).
show more ...
|
#
526d9427 |
| 15-Mar-2012 |
christos <christos@NetBSD.org> |
- ansify, knf. - no functional changes
|
#
c5e820ca |
| 13-Mar-2012 |
christos <christos@NetBSD.org> |
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 t
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@
show more ...
|
#
cfbb35ed |
| 25-Oct-2009 |
christos <christos@NetBSD.org> |
revert some of dsl's changes to make things build on i386; he can undo what he wants when he comes back.
|
#
5f1a9bea |
| 25-Oct-2009 |
dsl <dsl@NetBSD.org> |
Lint is differentially far too picky... Remove some warnings that only appear on i386 (not on amd64) and that for some reason best known to others are deemed fatal for i386. Making this code 'pass li
Lint is differentially far too picky... Remove some warnings that only appear on i386 (not on amd64) and that for some reason best known to others are deemed fatal for i386. Making this code 'pass lint' does absolutely nothing for its readability (etc).
show more ...
|
#
0b807be8 |
| 24-Oct-2009 |
dsl <dsl@NetBSD.org> |
Remove a load of pointless casts - one that even lint doesn't bleat about.
|
#
e1e343f9 |
| 31-Jan-2009 |
lukem <lukem@NetBSD.org> |
sign-compare fix
|
#
eb7c1594 |
| 07-Aug-2003 |
agc <agc@NetBSD.org> |
Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22280, verified by myself.
|
#
3fdac2b8 |
| 18-Jan-2003 |
thorpej <thorpej@NetBSD.org> |
Merge the nathanw_sa branch.
|
#
fa11ebb1 |
| 25-Jan-2001 |
lukem <lukem@NetBSD.org> |
apparently ansi c only required fread(3) to return 0 if size or nmembs == 0. however, susv2 adds the same to fwrite(3), so add the explicit check. document this for both fread & fwrite. move diagasse
apparently ansi c only required fread(3) to return 0 if size or nmembs == 0. however, susv2 adds the same to fwrite(3), so add the explicit check. document this for both fread & fwrite. move diagassert for buf!=NULL to after the (size * nmembs) == 0 check.
this has the helpful side effect of preventing the _DIAGASSERT()ion in fwrite() being triggered by lots of 3rdparty code that calls fwrite() with buf=NULL count=0
show more ...
|
#
d8962612 |
| 20-Sep-1999 |
lukem <lukem@NetBSD.org> |
back out the #ifdef _DIAGNOSTIC argument checks; too many people complained. _DIAGASSERT() is still retained.
|
#
e0f82c3a |
| 17-Sep-1999 |
lukem <lukem@NetBSD.org> |
revert previous; if we examine SUS more closely we find that unless explictly specified, use of a NULL pointer is undefined
|
#
3471ac66 |
| 16-Sep-1999 |
lukem <lukem@NetBSD.org> |
return (0) if size or count == 0 before check for _DIAGASSERT(buf != NULL). this is ok according to SUS.
|
#
b48252f3 |
| 16-Sep-1999 |
lukem <lukem@NetBSD.org> |
* 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 attemp
* 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
show more ...
|
#
c8bafd62 |
| 03-Feb-1998 |
perry <perry@NetBSD.org> |
remove obsolete register declarations
|
#
da2013ac |
| 19-Jan-1998 |
jtc <jtc@NetBSD.org> |
Use FLOCKFILE() and FUNLOCKFILE() macros from reentrant.h so that stdio can be made thread-safe.
|
#
23312f88 |
| 13-Jul-1997 |
christos <christos@NetBSD.org> |
Fix RCSID's Fix gcc warnings. Add prototypes for functions that were declared in more than one place to local.h or extern.h and use that instead.
|
#
255db7b2 |
| 02-Feb-1995 |
jtc <jtc@NetBSD.org> |
Merged with 4.4lite. Changed to conform to NetBSD's new RCS Id convention.
|
#
b30024a6 |
| 14-Dec-1993 |
jtc <jtc@NetBSD.org> |
Change from Chris Torek (via comp.std.c) to make fread() ANSI compliant.
|
#
75e26868 |
| 04-Oct-1993 |
jtc <jtc@NetBSD.org> |
fread and fwrite both return size_t, not int.
|
#
9c20f740 |
| 26-Aug-1993 |
jtc <jtc@NetBSD.org> |
Declare rcsid strings so they are stored in text segment.
|