| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
| |
__printf_render_int(): small type change to match use.
Variable l is consistently used as an int rather than a char.
Sort names while here.
Obtained from: Apple's Libc-1244.30.3
Notes:
svn path=/stable/10/; revision=330097
|
| |
|
|
|
|
|
| |
Remove redundant sys/cdefs.h include.
Notes:
svn path=/stable/10/; revision=325381
|
| |
|
|
|
|
|
|
|
|
|
| |
fopen(3): make manlint fixes
- Break on new lines.
- Use .Dv with NULL.
- Rewrap lines as necessary/when possible.
Notes:
svn path=/stable/10/; revision=321120
|
| |
|
|
|
|
|
|
|
| |
Make stdio deferred cancel-safe.
Requested by: eugen
Notes:
svn path=/stable/10/; revision=321074
|
| |
|
|
|
|
|
| |
Fix error handling.
Notes:
svn path=/stable/10/; revision=305583
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
1) Fix errors handling.
2) Prevent out of bounds access to ws[-1] (passed buffer) which happens
when the first mb sequence is incomplete and there are not enougn chars in
the read buffer. ws[-1] may lead to memory faults or false results, in
case the memory here contains '\n'.
3) Fix n == 1 case. Here should be no physical read (fill buffer) attempt
(we read n - 1 chars with the room for NUL, see fgets()),
and no NULL return.
Notes:
svn path=/stable/10/; revision=305577
|
| |
|
|
|
|
|
|
|
|
| |
fgetwc(3) may set both __SEOF and __SERR at once (in case of incomplete
sequence near EOF), so we can't just check for
(wc == WEOF && !__sfeof(fp)) and must relay on __sferror(fp) with
__SERR clearing/restoring.
Notes:
svn path=/stable/10/; revision=305403
|
| |
|
|
|
|
|
|
| |
If error happens, don't overwrite original errno comes from __mbrtowc()
and __srefill().
Notes:
svn path=/stable/10/; revision=305369
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
1) Don't forget to set __SERR on __slbexpand() error.
2) Remove "Fast path" from fgetwc()/fputwc() since it can't detect
encoding errors and ignores them all.
One of affected encoding example: US-ASCII
3) Original fgetln() from 44lite return success for line tail errors,
i.e. partial line, but set __SERR and errno in the same time, which
is inconsistent.
Now both OpenBSD and NetBSD return failure, i.e. no line and set error
indicators for such case, so make our fgetln() and fgetwln()
(as its wide version) compatible with the rest of *BSD.
PR: 212033
Notes:
svn path=/stable/10/; revision=304893
|
| |
|
|
|
|
|
|
|
|
|
| |
Don't check for __SERR which may stick from one of any previous stdio
functions.
__SERR is for user and the rest of stdio code do not check it
for error sensing internally, only set it.
In vf(w)printf.c here it is more easy to save __SERR, clear and restore it.
Notes:
svn path=/stable/10/; revision=304888
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
getln: We cannot expand the buffer beyond INT_MAX (_size overflows).
In such cases return ENOMEM. This is a limitation of our
implementation, alternatively you may consider getline(3).
Differential Revision: https://reviews.freebsd.org/D442 (Partial)
Obtained from: Apple Inc. (Libc 997.90.3)
Notes:
svn path=/stable/10/; revision=304816
|
| |
|
|
|
|
|
|
| |
MFC at whole.
Set __SERR on __slbexpand() errors.
Notes:
svn path=/stable/10/; revision=304648
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
1) Eliminate possibility to call __*collate_range_cmp() with inclomplete
locale (which cause core dump) by removing whole 'table' argument
by which it passed.
2) Restore __collate_range_cmp() in __sccl().
3) Collating [a-z] range in regcomp() works for single byte locales only
(we can't do it for other ones). In previous state only first 256
wide chars are considered and all others are just silently dropped from the
range.
Notes:
svn path=/stable/10/; revision=303185
|
| |
|
|
| |
Notes:
svn path=/stable/10/; revision=294781
|
| |
|
|
|
|
|
|
|
|
| |
Use stdint.h instead of inttypes.h as the latter pollutes namespace more
Submitted by: bde
Sponsored by: EMC / Isilon Storage Division
Notes:
svn path=/stable/10/; revision=292150
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Fix compilation when -DDEBUG is defined by adding inttypes.h #include
for intmax_t
Differential Revision: https://reviews.freebsd.org/D4434
Reported by: cppcheck
Reviewed by: jhb
Sponsored by: EMC / Isilon Storage Division
Notes:
svn path=/stable/10/; revision=292140
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
r285140 (by oshogbo):
Add fdclose(3) function.
This function is equivalent to fclose(3) function except that it
does not close the underlying file descriptor.
fdclose(3) is step forward to make FILE structure private.
Reviewed by: wblock, jilles, jhb, pjd
Approved by: pjd (mentor)
Differential Revision: https://reviews.freebsd.org/D2697
Notes:
svn path=/stable/10/; revision=291602
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
r278932 (by pfg):
libc: clean some set-but-not-used errors.
These were found by gcc 5.0 on Dragonfly BSD, however I
made no attempt to silence the false positives.
Obtained from: DragonFly (cf515c3a6f3a8964ad592e524442bc628f8ed63b)
Notes:
svn path=/stable/10/; revision=291573
|
| |
|
|
|
|
|
|
|
| |
r269326 (by n_hibma):
Fix the example: free the memory that was allocated by getline().
Notes:
svn path=/stable/10/; revision=291572
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
r288006 (by rodrigc):
Add declarations to eliminate -Wmissing-prototypes warnings
r288031 (by rodrigc):
Remove names from some prototypes
r288032 (by rodrigc):
Remove names from some prototypes
r288033 (by rodrigc):
Use ANSI C prototypes. Eliminates -Wold-style-definition warnings.
Notes:
svn path=/stable/10/; revision=291336
|
| |
|
|
|
|
|
|
|
|
|
| |
r258245 (by eadler):
Add missing include files for the printf_l and scanf_l man pages.
Reported by: swildner@dragonflybsd.org
Notes:
svn path=/stable/10/; revision=291294
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Discussed with: jilles
r264737 (by jilles):
libc/stdio: Fail fdopen() on an execute-only fd.
An execute-only fd (opened with O_EXEC) allows neither read() nor write()
and is therefore incompatible with all stdio modes. Therefore, the [EINVAL]
error applies.
Also adjust the similar check in freopen() with a NULL path, even though
this checks an fd which is already from a FILE.
Notes:
svn path=/stable/10/; revision=291293
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
r290549:
Reorganize code to elimitate one _sseek() call for append modes.
r290729:
1) Remove my overcomplicated error fallback and just return error
immediatelly as old code does, now for append modes too.
Real use case for such fallback is impossible (unless specially crafted).
2) Remove now unneded include I forgot to remove in prev. commits.
Notes:
svn path=/stable/10/; revision=291050
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
r290232:
Microoptimize.
r290231:
Addition to prev. commit.
In some edge cases fp->_p can be changed in _sseek(), recalculate.
r290230:
Don't seek to the end if write buffer is empty (in append modes).
PR: 204156
r290110:
Add _flags2 per jhb@ suggestion since no room left in _flags.
Rewrite O_APPEND flag checking using new __S2OAP flag.
r289931:
According to POSIX, a write operation shall start at the current size of
the stream (if mode had 'a' as the first character).
r289863:
Since no room left in the _flags, reuse __SALC for O_APPEND.
It helps to remove _fcntl() call from _ftello() and optimize seek position
calculation in _swrite().
Notes:
svn path=/stable/10/; revision=290544
|
| |
|
|
|
|
|
| |
Fix a couple of markup typos.
Notes:
svn path=/stable/10/; revision=288464
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Switch libc from using _sig{procmask,action,suspend} symbols, which
are aliases for the syscall stubs and are plt-interposed, to the
libc-private aliases of internally interposed sigprocmask() etc.
MFC r287300:
Use libthr interposed functions instead of syscalls, in posix_spawn()'
child.
Notes:
svn path=/stable/10/; revision=287480
|
| |
|
|
|
|
|
|
| |
Reassign copyright statements on several files from Advanced
Computing Technologies LLC to Hudson River Trading LLC.
Notes:
svn path=/stable/10/; revision=283927
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
MFC r266971:
- Return NULL and set errno to EINVAL if size is 0 (as required by POSIX).
Update the manpage to reflect this change.
- Always set the current position to the first null-byte when opening in append
mode. This makes the implementation compatible with glibc's. Update the test
suite.
Reported by: pho
Approved by: cognet
Notes:
svn path=/stable/10/; revision=277016
|
| |
|
|
|
|
|
|
|
|
| |
Fix buffer overflow in stdio.
Security: FreeBSD-SA-14:27.stdio
Security: CVE-2014-8611
Notes:
svn path=/stable/10/; revision=275667
|
| |
|
|
|
|
|
| |
Fix prototypes.
Notes:
svn path=/stable/10/; revision=274943
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Update fflush(3) to return success on a read-only stream.
This is done for compliance with SUSv3. The changes cause
no secondary effects in the gnulib tests (we pass them).
Obtained from: Apple Inc. (Libc 997.90.3 with changes)
Reviewed by: bde
Phabric: D440
Notes:
svn path=/stable/10/; revision=270035
|
| |
|
|
|
|
|
|
|
|
| |
In the "Too many open files" edge cases don't try to preserve old
number for non-std* descriptors, but close old file and retry.
Obtained from: inspired by Apple's change from pfg@
Notes:
svn path=/stable/10/; revision=269624
|
| |
|
|
|
|
|
|
|
| |
For "a"-mode files and rewind/fseek + fwrite combination return meaningful
value now, like Apple does, but avoid their __sflush physical write
performance degradation as much as possible.
Notes:
svn path=/stable/10/; revision=269623
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use a correct errno in freopen.
Use EBADF instead of EINVAL when working around incorrect O_ACCMODE.
Adjust errno on failed prepwrite.
rewind: always clear error indicator as required by POSIX.
Obtained from: Apple Inc. (Libc 997.90.3)
Phabric: D442
Notes:
svn path=/stable/10/; revision=269482
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Avoid possible cast degradation.
Assign iov_len first, avoiding the cast to uio_resid
(int in stdio) from degrading the value.
Small cosmetical fix while here.
Notes:
svn path=/stable/10/; revision=269085
|
| |
|
|
|
|
|
|
|
| |
Const-ify a character string.
Obtained from: Apple Inc. (Libc 997.90.3)
Notes:
svn path=/stable/10/; revision=269007
|
| |
|
|
|
|
|
|
| |
libc man pages: Remove reference to non-existent FreeBSD Security
Architecture
Notes:
svn path=/stable/10/; revision=262965
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Austin Group issue #411 requires 'e' to be accepted before and after 'x',
and encourages accepting the characters in any order, except the initial
'r', 'w' or 'a'.
Given that glibc accepts the characters after r/w/a in any order and that
diagnosing this problem may be hard, change our libc to behave that way as
well.
Notes:
svn path=/head/; revision=255303
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This ensures strerror() and friends continue to work correctly even if a
(non-PIE) executable linked against an older libc imports sys_errlist (which
causes sys_errlist to refer to the executable's copy with a size fixed when
that executable was linked).
The executable's use of sys_errlist remains broken because it uses the
current value of sys_nerr and may access past the bounds of the array.
Different from the message "Using sys_errlist from executables is not
ABI-stable" on freebsd-arch, this change does not affect the static library.
There seems no reason to prevent overriding the error messages in the static
library.
Notes:
svn path=/head/; revision=255108
|
| |
|
|
|
|
|
|
| |
These are like mkstemp() and mkstemps() but allow passing open(2) flags like
O_CLOEXEC.
Notes:
svn path=/head/; revision=254151
|
| |
|
|
| |
Notes:
svn path=/head/; revision=253277
|
| |
|
|
|
|
|
|
|
| |
mktemp(), mkstemp() and mkdtemp() are available in standard <stdlib.h> and
also in <unistd.h>. Encourage use of the former by listing it in the
synopsis.
Notes:
svn path=/head/; revision=252838
|
| |
|
|
|
|
|
| |
And add '__restrict' where it appeared in the header prototypes
Notes:
svn path=/head/; revision=249810
|
| |
|
|
|
|
|
|
|
|
| |
NetBSD, OpenBSD, and Android's Bionic all number the clauses 1 through 3,
so follow suit to make comparison easier.
Acked-by: imp@
Notes:
svn path=/head/; revision=249808
|
| |
|
|
| |
Notes:
svn path=/head/; revision=249381
|
| |
|
|
| |
Notes:
svn path=/head/; revision=249360
|
| |
|
|
| |
Notes:
svn path=/head/; revision=247415
|
| |
|
|
|
|
|
|
|
|
|
|
| |
routines provide write-only stdio FILE objects that store their data in a
dynamically allocated buffer. They are a string builder interface somewhat
akin to a completely dynamic sbuf.
Reviewed by: bde, jilles (earlier versions)
MFC after: 1 month
Notes:
svn path=/head/; revision=247411
|
| |
|
|
|
|
|
|
|
|
| |
The brokenness of setbuf() is not specific to 4.2BSD and 4.3BSD but inherent
in the API definition.
Reported by: bde
Notes:
svn path=/head/; revision=246952
|
| |
|
|
| |
Notes:
svn path=/head/; revision=246824
|