| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
| |
only, so works for only special fdopen() case. Add real O_APPEND too.
|
|
|
|
|
|
|
|
| |
Check for __SAPP flag before calling sflush. This avoids
performance degradation compared to the previous approach.
Submitted by: ache
MFC after: 2 weeks
|
|
|
|
|
|
| |
In fputs() avoid implcit casting on iov.iov_len.
MFC after: 3 days
|
|
|
|
|
|
| |
Obtained from: Apple Inc. (Libc 997.90.3)
Phabric: D442
MFC after: 2 weeks
|
|
|
|
|
|
|
|
| |
Required by POSIX:
http://pubs.opengroup.org/onlinepubs/009695399/functions/rewind.html
Obtained from: Apple Inc. (Libc 997.90.3)
MFC after: 1 week
|
|
|
|
|
|
| |
Obtained from: Apple Inc. (Libc 997.90.3)
Phabric: D442
MFC after: 1 week
|
|
|
|
|
| |
Obtained from: Apple Inc. (Libc 997.90.3)
MFC after: 3 days
|
|
|
|
|
|
|
|
|
| |
Use EBADF instead of EINVAL when working around incorrect O_ACCMODE.
Phabric: D442
Obtained from: Apple Inc. (Libc 997.90.3)
Reviewed by: jilles
MFC after: 1 week
|
|
|
|
|
|
|
|
|
|
| |
This has small changes to what Apple uses 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
|
|
|
|
|
| |
PR: 191174
Submitted by: Franco Fichtner <franco at lastsummer.de>
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
Architecture
MFC After: 3 days
|
|
|
|
|
|
|
|
|
|
|
| |
if not already defined. This allows building libc from outside of
lib/libc using a reach-over makefile.
A typical use-case is to build a standard ILP32 version and a COMPAT32
version in a single iteration by building the COMPAT32 version using a
reach-over makefile.
Obtained from: Juniper Networks, Inc.
|
|
|
|
| |
Reported by: swildner@dragonflybsd.org
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
These are like mkstemp() and mkstemps() but allow passing open(2) flags like
O_CLOEXEC.
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
And add '__restrict' where it appeared in the header prototypes
|
|
|
|
|
|
|
| |
NetBSD, OpenBSD, and Android's Bionic all number the clauses 1 through 3,
so follow suit to make comparison easier.
Acked-by: imp@
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
The brokenness of setbuf() is not specific to 4.2BSD and 4.3BSD but inherent
in the API definition.
Reported by: bde
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
names, unnecessary casts)
- Change type of boolean variable from char to bool
Suggested by: jhb, zont, jmallett
Reviewed by: cognet
Approved by: cognet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
with the user's namespace.
- Correct size and position variables type from long to size_t.
- Do not set errno to ENOMEM on malloc failure, as malloc already does so.
- Implement the concept of "buffer data length", which mandates what SEEK_END
refers to and the allowed extent for a read.
- Use NULL as read-callback if the buffer is opened in write-only mode.
Conversely, use NULL as write-callback when opened in read-only mode.
- Implement the handling of the ``b'' character in the mode argument. A binary
buffer differs from a text buffer (default mode if ``b'' is omitted) in that
NULL bytes are never appended to writes and that the "buffer data length"
equals to the size of the buffer.
- Remove shall from the man page. Use indicative instead. Also, specify that
the ``b'' flag does not conform with POSIX but is supported by glibc.
- Update the regression test so that the ``b'' functionality and the "buffer
data length" concepts are tested.
- Minor style(9) corrections.
Suggested by: jilles
Reviewed by: cognet
Approved by: cognet
|
|
|
|
|
|
|
|
| |
with the respective regression test.
See http://pubs.opengroup.org/onlinepubs/9699919799/functions/fmemopen.html
Reviewed by: cognet
Approved by: cognet
|
|
|
|
|
|
|
|
|
| |
written. Use clearer text for this.
PR: docs/174023
Submitted by: Paul Procacci <pprocacci@gmail.com>
Approved by: bcr (mentor)
MFC after: 1 week
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit adds a new mode option 'e' that must follow any 'b', '+' and/or
'x' options. C11 is clear about the 'x' needing to follow 'b' and/or '+' and
that is what we implement; therefore, require a strict position for 'e' as
well.
For freopen() with a non-NULL path argument and fopen(), the close-on-exec
flag is set iff the 'e' mode option is specified. For freopen() with a NULL
path argument and fdopen(), the close-on-exec flag is turned on if the 'e'
mode option is specified and remains unchanged otherwise.
Although the same behaviour for fopen() can be obtained by open(O_CLOEXEC)
and fdopen(), this needlessly complicates the calling code.
Apart from the ordering requirement, the new option matches glibc.
PR: kern/169320
|
|
|
|
| |
MFC after: 2 weeks
|
|
|
|
| |
MFC after: 1 week
|
|
|
|
|
| |
Approved by: cperciva
MFC after: 3 days
|
|
|
|
|
|
| |
Change argument type from 'const unsigned char *' to 'const char *'.
MFC after: 2 weeks
|
|
|
|
|
|
|
|
|
|
| |
this fflush may fail to write data in the buffer.
PR: kern/137819
Submitted by: Eric Blake <ebb9@byu.net>
Reviewed by: theraven
Approved by: cperciva
MFC after: 2 weeks
|
|
|
|
|
|
|
|
|
| |
- libc/stdio/scanf_l.3
- libc/stdio/printf_l.3
Reviewed by: theraven
Approved by: gabor (mentor)
MFC after: 5 days
|
| |
|
|
|
|
|
| |
Approved by: cperciva
MFC after: 3 days
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The typical case was:
static __inline int
convert_ccl(FILE *fp, char * __restrict p, [...])
{
[...]
if (p == SUPPRESS_PTR) {
[...]
} else {
[...]
}
[...]
}
This qualifier says that the pointer is the only one at that time
pointing to the resource.
Here, clang considers that "p" will never match "SUPPRESS_PTR" and
optimize the if{} block out. This leads to segfaults in programs calling
vfscanf(3) and vfwscanf(3) with just the format string (no arguments
following it).
The following softwares were reported to abort with segmentation fault
and this patch fixes it:
o cmake
o smartd
o devel/ORBit2
dim@ opened an LLVM PR to discuss this clang optimization:
http://llvm.org/bugs/show_bug.cgi?id=12656
Tested by: bsam@
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
conversions. Both the specification and the documentation say the
width is interpreted as the max number of wide characters to read, but
the implementation was interpreting it as the number of bytes to convert.
(See also r105317.)
This change has security implications for any applications that depend
on the buggy behavior, but the impact in practice is probably nil.
Any such application would already be buggy on other platforms that
get the semantics right. Also, these conversions are rarely used;
%ls, %lc, and %l[ are more appropriate.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
reading wide characters manually. With this change, they now use
fgetwc(). To make this work, we use an internal version of fgetwc()
with a few extensions: it takes an mbstate * because non-wide streams
don't have a built-in mbstate, and it indicates the number of bytes
read.
vfscanf() now resembles vfwscanf() more closely. Minor functional
improvements include working xlocale support in vfscanf(), setting the
stream error indicator on encoding errors, and proper handling of
shift-based encodings. (Actually, making shift-based encodings work
with non-wide streams is hopeless, but the implementation now matches
the broken specification.)
|
|
|
|
|
| |
Submitted by: brueffer
Approved by: kib (mentor)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This tool changes the default buffering behaviour of standard
stdio streams.
It only works on dynamic binaries. To make it work for static
ones it would require cluttering stdio because there no single
entry point.
PR: 166660
Reviewed by: current@, jhb
Approved by: kib (mentor)
MFC after: 1 week
|
|
|
|
|
|
|
|
|
| |
indicates the avaliability of FILE, to prevent possible reordering of
the writes as seen by other CPUs.
Reported by: Fengwei yin <yfw.bsd gmail com>
Reviewed by: jhb
MFC after: 1 week
|
|
|
|
| |
characters read.
|
| |
|