| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
| |
- Use an initializer macro to initialize fields in 'fake' FILE objects used
by *sprintf(), etc.
- Explicitly initialize _fl_mutex to PTHREAD_MUTEX_INITIALIZER for all FILE
objects. This is currently a nop on FreeBSD, but is import for other
platforms (or in the future) where PTHREAD_MUTEX_INITIALIZER is not simply
zero.
Notes:
svn path=/stable/8/; revision=213720
|
| |
|
|
| |
Notes:
svn path=/stable/8/; revision=213473
|
| |
|
|
|
|
|
|
| |
PR: docs/141125
Submitted by: Jeremy Huddleston <jeremyhu@apple.com>
Notes:
svn path=/stable/8/; revision=209349
|
| |
|
|
|
|
|
|
|
|
|
| |
In _gettemp(), check that the length of the path doesn't exceed
MAXPATHLEN. Otherwise the path name (or part of it) may not fit to
carrybuf causing a buffer overflow.
PR: bin/140228
Notes:
svn path=/stable/8/; revision=205070
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Better glibc compatibility for getline/getdelim:
- Tolerate applications that pass a NULL pointer for the buffer and
claim that the capacity of the buffer is nonzero.
- If an application passes in a non-NULL buffer pointer and claims the
buffer has zero capacity, we should free (well, realloc) it
anyway. It could have been obtained from malloc(0), so failing to
free it would be a small memory leak.
Notes:
svn path=/stable/8/; revision=202947
|
| |
|
|
|
|
|
|
|
|
| |
Use vsprintf instead of rolling our own.
PR: bin/140496
Submitted by: Jeremy Huddleston <jeremyhu apple.com>
Notes:
svn path=/stable/8/; revision=202666
|
| |
|
|
|
|
|
|
|
|
| |
Use vsscanf instead of rolling our own.
PR: bin/140530
Submitted by: Jeremy Huddleston <jeremyhu apple.com>
Notes:
svn path=/stable/8/; revision=202665
|
| |
|
|
|
|
|
| |
K&R -> ANSI prototype.
Notes:
svn path=/stable/8/; revision=202664
|
| |
|
|
|
|
|
| |
Remove unnecessary quoting and markup, add missing punctuation.
Notes:
svn path=/stable/8/; revision=202413
|
| |
|
|
|
|
|
| |
Fix the dprintf() prototype.
Notes:
svn path=/stable/8/; revision=200211
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Eliminate dead stores.
In __mbsconv(), if prec was zero, nconv could have been used
uninitialized. Initialize it to a safe value so that there's no
chance of returning an error if stack garbage happens to be equal to
(size_t)-1 or (size_t)-2.
In svc_raw_reply(), don't leave stat uninitialized if the MSG_ACCEPTED
&& SUCCESS case succeeds. The stack garbage might be zero.
In clnt_raw_create(), avoid minor race condition initializing the
file-scope variable clntraw_private.
Found by: Clang static analyzer
Notes:
svn path=/stable/8/; revision=200016
|
| |
|
|
|
|
|
|
|
|
|
| |
Right now nmemb is returned when size is 0. In newer versions of the
standards, it is explicitly required that fwrite() should return 0.
Submitted by: Christoph Mallon
Approved by: re (kib)
Notes:
svn path=/head/; revision=195637
|
| |
|
|
|
|
|
|
|
|
|
| |
because it means getdelim() returns -1 for both error and EOF, and
never returns 0. However, this is what the original GNU implementation
does, and POSIX inherited the bug.
Reported by: marcus@
Notes:
svn path=/head/; revision=190773
|
| |
|
|
|
|
|
|
|
| |
dprintf() is a simple wrapper around another function, so we may as
well implement it. But also like getline(), we can't prototype it by
default right now because it would break too many ports.
Notes:
svn path=/head/; revision=189356
|
| |
|
|
|
|
|
|
| |
number of functions that have an incestuous relationship with the
arcane innards of stdio.
Notes:
svn path=/head/; revision=189271
|
| |
|
|
|
|
|
| |
a size_t *, although the distinction is moot in practice.
Notes:
svn path=/head/; revision=189268
|
| |
|
|
|
|
|
| |
Reviewed by: md5(1)
Notes:
svn path=/head/; revision=189249
|
| |
|
|
| |
Notes:
svn path=/head/; revision=189138
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
wcscasecmp(), and wcsncasecmp().
- Make some previously non-standard extensions visible
if POSIX_VISIBLE >= 200809.
- Use restrict qualifiers in stpcpy().
- Declare off_t and size_t in stdio.h.
- Bump __FreeBSD_version in case the new symbols (particularly
getline()) cause issues with ports.
Reviewed by: standards@
Notes:
svn path=/head/; revision=189136
|
| |
|
|
|
|
|
|
|
|
| |
Fix harmless but related bugs in %_$zd and %_$tu.
PR: 131880
MFC after: 1 week
Notes:
svn path=/head/; revision=189131
|
| |
|
|
|
|
|
| |
Submitted by: keramida and jhb
Notes:
svn path=/head/; revision=187823
|
| |
|
|
|
|
|
| |
Noticed by: bde
Notes:
svn path=/head/; revision=187817
|
| |
|
|
| |
Notes:
svn path=/head/; revision=187809
|
| |
|
|
|
|
|
|
|
|
|
|
| |
the EOF indicator, fseek() may also be used for this.
Bump document date.
PR: 76333
Submitted by: Yoshihiko Sarumaru <mistral@imasy.or.jp>
Notes:
svn path=/head/; revision=187805
|
| |
|
|
|
|
|
|
|
|
|
| |
The integer thousands' separator code is rewritten in order to
avoid having to preallocate a buffer for the largest possible
digit string with the most possible instances of the longest
possible multibyte thousands' separator. The new version inserts
thousands' separators for integers using the same code as floating point.
Notes:
svn path=/head/; revision=187582
|
| |
|
|
|
|
|
|
| |
A forthcoming gdtoa import is needed to make this fully work.
- Improve the way "nan(...)" is parsed.
Notes:
svn path=/head/; revision=187422
|
| |
|
|
| |
Notes:
svn path=/head/; revision=187421
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
sets up a fake buffered FILE and then effectively calls itself
recursively. Unfortunately, gcc doesn't know how to do tail call
elimination in this case, and actually makes things worse by
inlining __sbprintf(). This means that f[w]printf() to stderr was
allocating about 5k of stack on 64-bit platforms, much of which was
never used.
I've reorganized things to eliminate the waste. In addition to saving
some stack space, this improves performance in my tests by anywhere
from 5% to 17% (depending on the test) when -fstack-protector is
enabled. I found no statistically significant performance difference
when stack protection is turned off. (The tests redirected stderr to
/dev/null.)
Notes:
svn path=/head/; revision=187369
|
| |
|
|
|
|
|
| |
reduces the code size by about 10% and improves performance slightly.
Notes:
svn path=/head/; revision=187354
|
| |
|
|
|
|
|
|
|
|
|
| |
to get rid of restrict qualifier discarding. This lets libc compile
cleanly in gnu99 mode.
Suggested by: kib, christoph.mallon at gmx.de
Approved by: kib (mentor)
Notes:
svn path=/head/; revision=187302
|
| |
|
|
|
|
|
|
| |
vfprintf.c and vfwprintf.c (except for char/wchar_t differences) to a
common header file.
Notes:
svn path=/head/; revision=187284
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
slightly less evil inline functions, and move the buffering state into
a struct. This will make it possible for helper routines to produce
output for printf() directly, making it possible to untangle the code
somewhat.
In wprintf(), use the same buffering mechanism to reduce diffs to
printf(). This has the side-effect of causing wprintf() to catch write
errors that it previously ignored.
Notes:
svn path=/head/; revision=187277
|
| |
|
|
|
|
|
|
| |
PR: 127335
MFC after: 2 weeks
Notes:
svn path=/head/; revision=186887
|
| |
|
|
| |
Notes:
svn path=/head/; revision=185904
|
| |
|
|
|
|
|
| |
middle of vfprintf's variable declarations.
Notes:
svn path=/head/; revision=185825
|
| |
|
|
|
|
|
|
|
|
| |
sizeof(size_t), i.e. on all 64-bit platforms.
Reported by: Andrey V. Elsukov
MFC after: 3 days
Notes:
svn path=/head/; revision=185516
|
| |
|
|
|
|
|
|
|
|
| |
this commit, sprintf("%s", "") could fail depending on what happened
to be on the stack.
Found by: LLVM/Clang Static Checker
Notes:
svn path=/head/; revision=181281
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
mkstemps(), and mkdtemp().
- Add proper range checking for the 'slen' parameter passed to mkstemps().
- Try all possible permutations of a template if a collision is encountered.
Previously, once a single template character reached 'z', it would not wrap
around to '0' and keep going until it encountered the original starting
letter. In the edge case that the randomly generated starting name used
all 'z' characters, only that single name would be tried before giving up.
PR: standards/66531
Submitted by: Jim Luther
Obtained from: Apple
MFC after: 1 week
Notes:
svn path=/head/; revision=180938
|
| |
|
|
| |
Notes:
svn path=/head/; revision=180696
|
| |
|
|
| |
Notes:
svn path=/head/; revision=180107
|
| |
|
|
|
|
|
| |
bit by removing some calls to the inline function addtype().
Notes:
svn path=/head/; revision=180106
|
| |
|
|
|
|
|
|
|
| |
normal and wide character versions of it.
No functional change.
Notes:
svn path=/head/; revision=180105
|
| |
|
|
|
|
|
|
|
| |
by moving the positional argument handling code to a new file,
printf-pos.c, and moving common definitions to printflocal.h.
No functional change intended.
Notes:
svn path=/head/; revision=180104
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In particular, encapsulate the state of the type table in a struct,
and add inline functions to initialize, free, and manipulate that
state. This replaces some ugly macros that made proper error handling
impossible.
While here, remove an unneeded test for NULL and a variable that is
initialized (many times!) but never used. The compiler didn't catch
these because of rampant use of the same variable to mean different
things in different places.
This commit should not cause any changes in functionality.
Notes:
svn path=/head/; revision=180102
|
| |
|
|
|
|
|
|
|
|
|
|
| |
variable nofile.
PR: 123109
Submitted by: Christoph Mallon
Approved by: rwatson (mentor)
MFC after: 1 month
Notes:
svn path=/head/; revision=178921
|
| |
|
|
|
|
|
| |
as we aren't hiding FILE's internals anymore.
Notes:
svn path=/head/; revision=178782
|
| |
|
|
|
|
|
|
| |
all the previous inline optimizations as well. FILE is back to using
__mbstate_t, struct pthread *, and struct pthread_mutex *.
Notes:
svn path=/head/; revision=178778
|
| |
|
|
|
|
|
| |
name space.
Notes:
svn path=/head/; revision=178756
|
| |
|
|
|
|
|
|
|
|
| |
__sFILE. It's opaque now, so add a function that returns the pending
output bytes.
Pointy hat: jhb
Notes:
svn path=/head/; revision=178755
|
| |
|
|
|
|
|
|
|
|
|
| |
accessor functions for its benefit now thaat FILE is opaque.
I'm sure there's a better way. I leave that for people to work
on in a src tree that isn't broken.
Pointy hat: jhb
Notes:
svn path=/head/; revision=178747
|