|
Revision tags: release/13.4.0-p5, release/13.5.0-p1, release/14.2.0-p3, release/13.5.0, release/14.2.0-p2, release/14.1.0-p8, release/13.4.0-p4, release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3, release/14.2.0, release/13.4.0, release/14.1.0, release/13.3.0, release/14.0.0 |
|
| #
4025b5b5 |
| 01-Nov-2023 |
Warner Losh <[email protected]> |
libc: Purge unneeded cdefs.h
These sys/cdefs.h are not needed. Purge them. They are mostly left-over from the $FreeBSD$ removal. A few in libc are still required for macros that cdefs.h defines. Kee
libc: Purge unneeded cdefs.h
These sys/cdefs.h are not needed. Purge them. They are mostly left-over from the $FreeBSD$ removal. A few in libc are still required for macros that cdefs.h defines. Keep those.
Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D42385
(cherry picked from commit 559a218c9b257775fb249b67945fe4a05b7a6b9f)
show more ...
|
| #
1d386b48 |
| 16-Aug-2023 |
Warner Losh <[email protected]> |
Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
|
Revision tags: release/13.2.0, release/12.4.0, release/13.1.0, release/12.3.0, release/13.0.0, release/12.2.0, release/11.4.0 |
|
| #
0573d0a9 |
| 20-Feb-2020 |
Mateusz Guzik <[email protected]> |
vfs: add realpathat syscall
realpath(3) is used a lot e.g., by clang and is a major source of getcwd and fstatat calls. This can be done more efficiently in the kernel.
This works by performing a r
vfs: add realpathat syscall
realpath(3) is used a lot e.g., by clang and is a major source of getcwd and fstatat calls. This can be done more efficiently in the kernel.
This works by performing a regular lookup while saving the name and found parent directory. If the terminal vnode is a directory we can resolve it using usual means. Otherwise we can use the name saved by lookup and resolve the parent.
See the review for sample syscall counts.
Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D23574
show more ...
|
|
Revision tags: release/12.1.0, release/11.3.0 |
|
| #
df5e3924 |
| 26-Jun-2019 |
Alex Richardson <[email protected]> |
Fix -Wsign-compare warnings in realpath.c
This is needed in order to build realpath.c as part of rtld.
|
|
Revision tags: release/12.0.0, release/11.2.0 |
|
| #
d915a14e |
| 25-Nov-2017 |
Pedro F. Giffuni <[email protected]> |
libc: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I was using mis-identified many licenses so this was mostly a manual - error p
libc: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I was using mis-identified many licenses so this was mostly a manual - error prone - task.
The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts.
show more ...
|
|
Revision tags: release/10.4.0, release/11.1.0 |
|
| #
cf5cedd7 |
| 15-May-2017 |
Konstantin Belousov <[email protected]> |
Style.
Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
|
| #
d933a4c0 |
| 15-May-2017 |
Konstantin Belousov <[email protected]> |
Simplify cleanup on failure in realpath(3).
If realpath() allocated memory for result and failed, the memory is freed in each place where return is performed. More, the function needs to track the
Simplify cleanup on failure in realpath(3).
If realpath() allocated memory for result and failed, the memory is freed in each place where return is performed. More, the function needs to track the allocation status, to not free user-supplied buffer.
Consolidate the memory handling in the wrapper, freeing the buffer if the actual worker failed.
Reviewed by: emaste (previous version) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D10670
show more ...
|
| #
f81e5b2d |
| 15-May-2017 |
Konstantin Belousov <[email protected]> |
Fix several buffer overflows in realpath(3). - The statement "left_len -= s - left;" does not take the slash into account if one was found. This results in the invariant "left[left_len] == '\0'"
Fix several buffer overflows in realpath(3). - The statement "left_len -= s - left;" does not take the slash into account if one was found. This results in the invariant "left[left_len] == '\0'" being violated (and possible buffer overflows). The patch replaces the variable "s" with a size_t "next_token_len" for more clarity. - "slen" from readlink(2) can be 0 when encountering empty symlinks. Then, further down, "symlink[slen - 1]" underflows the buffer. When slen == 0, realpath(3) should probably return ENOENT (http://austingroupbugs.net/view.php?id=825, https://lwn.net/Articles/551224/).
Some other minor issues: - The condition "resolved_len >= PATH_MAX" cannot be true. - Similarly, "s - left >= sizeof(next_token)" cannot be true, as long as "sizeof(next_token) >= sizeof(left)". - Return ENAMETOOLONG when a resolved symlink from readlink(2) is too long for the symlink buffer (instead of just truncating it). - "resolved_len > 1" below the call to readlink(2) is always true as "strlcat(resolved, next_token, PATH_MAX);" always results in a string of length > 1. Also, "resolved[resolved_len - 1] = '\0';" is not needed; there can never be a trailing slash here. - The truncation check for "strlcat(symlink, left, sizeof(symlink));" should be against "sizeof(symlink)" (the third argument to strlcat) instead of "sizeof(left)".
Submitted by: Jan Kokemц╪ller <[email protected]> PR: 219154 MFC after: 2 weeks
show more ...
|
|
Revision tags: release/11.0.1, release/11.0.0, release/10.3.0, release/10.2.0, release/10.1.0, release/9.3.0 |
|
| #
310c8f3c |
| 13-Apr-2014 |
Jilles Tjoelker <[email protected]> |
realpath(): Properly fail "." or ".." components after non-directories.
If realpath() is called on pathnames like "/dev/null/." or "/dev/null/..", it should fail with [ENOTDIR]. Pathnames like "/dev
realpath(): Properly fail "." or ".." components after non-directories.
If realpath() is called on pathnames like "/dev/null/." or "/dev/null/..", it should fail with [ENOTDIR]. Pathnames like "/dev/null/" already failed as they should.
Also, put the check for non-directories after lstatting the previous component instead of when the empty component (consecutive or trailing slashes) is detected, saving an lstat() call and some lines of code.
PR: kern/82980 MFC after: 2 weeks
show more ...
|
|
Revision tags: release/10.0.0, release/9.2.0, release/8.4.0 |
|
| #
ab3f6b34 |
| 17-Apr-2013 |
Gabor Kovesdan <[email protected]> |
- Correct mispellings of the word occurrence
Submitted by: Christoph Mallon <[email protected]> (via private mail)
|
|
Revision tags: release/9.1.0 |
|
| #
7877ed7c |
| 12-Sep-2012 |
Ed Maste <[email protected]> |
Avoid mapping ENOENT to ENOTDIR for non-existent path components.
The ENOTDIR mapping was introduced in r235266 for kern/128933 based on an interpretation of the somewhat ambiguous language in the P
Avoid mapping ENOENT to ENOTDIR for non-existent path components.
The ENOTDIR mapping was introduced in r235266 for kern/128933 based on an interpretation of the somewhat ambiguous language in the POSIX realpath specification. The interpretation is inconsistent with Solaris and Linux, a regression from 9.0, and does not appear to be permitted by the description of ENOTDIR:
20 ENOTDIR Not a directory. A component of the specified pathname existed, but it was not a directory, when a directory was expected.
PR: standards/171577 MFC after: 3 days
show more ...
|
| #
5f5a5072 |
| 05-Jun-2012 |
Andrey A. Chernov <[email protected]> |
1) Although unpublished version of standard http://austingroupbugs.net/view.php?id=385#c713 (Resolved state) recommend this way for the current standard (called "earlier" in the text)
"However, earl
1) Although unpublished version of standard http://austingroupbugs.net/view.php?id=385#c713 (Resolved state) recommend this way for the current standard (called "earlier" in the text)
"However, earlier versions of this standard did not require this, and the same example had to be written as:
// buf was obtained by malloc(buflen) ret = write(fd, buf, buflen); if (ret < 0) { int save = errno; free(buf); errno = save; return ret; } "
from feedback I have for previous commit it seems that many people prefer to avoid mass code change needed for current standard compliance and prefer to track unpublished standard instead, which requires now that free() itself must save errno, not its usage code.
So, I back out "save errno across free()" part of previous commit, and will fill PR for changing free() isntead.
2) Remove now unused serrno.
MFC after: 1 week
show more ...
|
| #
96700463 |
| 04-Jun-2012 |
Andrey A. Chernov <[email protected]> |
1) IEEE Std 1003.1-2008, "errno" section, is explicit that
"The setting of errno after a successful call to a function is unspecified unless the description of that function specifies that errno sha
1) IEEE Std 1003.1-2008, "errno" section, is explicit that
"The setting of errno after a successful call to a function is unspecified unless the description of that function specifies that errno shall not be modified."
However, free() in IEEE Std 1003.1-2008 does not mention its interaction with errno, so MAY modify it after successful call (it depends on particular free() implementation, OS-specific, etc.).
So, save errno across free() calls to make code portable and POSIX-conformant.
2) Remove unused serrno assignment.
MFC after: 1 week
show more ...
|
| #
fdbe55fc |
| 11-May-2012 |
Konstantin Belousov <[email protected]> |
According to SUSv4, realpath(3) must fail if [ENOENT] A component of file_name does not name an existing file or file_name points to an empty string. [ENOTDIR] A component of the path prefix is
According to SUSv4, realpath(3) must fail if [ENOENT] A component of file_name does not name an existing file or file_name points to an empty string. [ENOTDIR] A component of the path prefix is not a directory, or the file_name argument contains at least one non- <slash> character and ends with one or more trailing <slash> characters and the last pathname component names an existing file that is neither a directory nor a symbolic link to a directory. Add checks for the listed conditions, and set errno accordingly.
Update the realpath(3) manpage to mention SUS behaviour. Remove the requirement to include sys/param.h before stdlib.h.
PR: 128933 MFC after: 3 weeks
show more ...
|
|
Revision tags: release/8.3.0_cvs, release/8.3.0, release/9.0.0 |
|
| #
24a92ae0 |
| 04-Nov-2011 |
Ed Schouten <[email protected]> |
Fix a warning emitted by Clang.
The size passed to strlcat() must depend on the input length, not the output length. Because the input and output buffers are equal in size, the resulting binary does
Fix a warning emitted by Clang.
The size passed to strlcat() must depend on the input length, not the output length. Because the input and output buffers are equal in size, the resulting binary does not change at all.
show more ...
|
|
Revision tags: release/7.4.0_cvs, release/8.2.0_cvs, release/7.4.0, release/8.2.0 |
|
| #
4e738f5a |
| 08-Jan-2011 |
Konstantin Belousov <[email protected]> |
Fix some style(9) issues. Do not use strlcpy() where simple assignment is enough.
Noted by: bde (long time ago) MFC after: 1 week
|
|
Revision tags: release/8.1.0_cvs, release/8.1.0 |
|
| #
14d447de |
| 04-May-2010 |
Konstantin Belousov <[email protected]> |
MFC r206893: Slightly modernize realpath(3).
SUSv4 requires that implementation returns EINVAL if supplied path is NULL, and ENOENT if path is empty string [1]. Bring prototype in conformance with S
MFC r206893: Slightly modernize realpath(3).
SUSv4 requires that implementation returns EINVAL if supplied path is NULL, and ENOENT if path is empty string [1]. Bring prototype in conformance with SUSv4, adding restrict keywords. Allow the resolved path buffer pointer be NULL, in which case realpath(3) allocates storage with malloc().
MFC r206898: Free() is not allowed to modify errno, remove safety brackets around it. Add small optimization, do not copy a string to the buffer that is to be freed immediately after.
MFC r206997: Move realpath(3) prototype to a POSIX section.
MFC r206998: Add standards section, improve wording, taking into account the handling of NULL and changed type in declaration.
show more ...
|
| #
655c8a60 |
| 20-Apr-2010 |
Konstantin Belousov <[email protected]> |
Free() is not allowed to modify errno, remove safety brackets around it [1]. Add small optimization, do not copy a string to the buffer that is to be freed immediately after.
Noted by: jh [1] Review
Free() is not allowed to modify errno, remove safety brackets around it [1]. Add small optimization, do not copy a string to the buffer that is to be freed immediately after.
Noted by: jh [1] Reviewed by: jh MFC after: 2 weeks
show more ...
|
| #
9d79ec20 |
| 20-Apr-2010 |
Konstantin Belousov <[email protected]> |
Slightly modernize realpath(3).
SUSv4 requires that implementation returns EINVAL if supplied path is NULL, and ENOENT if path is empty string [1]. Bring prototype in conformance with SUSv4, adding
Slightly modernize realpath(3).
SUSv4 requires that implementation returns EINVAL if supplied path is NULL, and ENOENT if path is empty string [1]. Bring prototype in conformance with SUSv4, adding restrict keywords. Allow the resolved path buffer pointer be NULL, in which case realpath(3) allocates storage with malloc().
PR: kern/121897 [1] MFC after: 2 weeks
show more ...
|
|
Revision tags: release/7.3.0_cvs, release/7.3.0, release/8.0.0_cvs, release/8.0.0, release/7.2.0_cvs, release/7.2.0, release/7.1.0_cvs, release/7.1.0, release/6.4.0_cvs, release/6.4.0, release/7.0.0_cvs, release/7.0.0, release/6.3.0_cvs, release/6.3.0, release/6.2.0_cvs, release/6.2.0, release/5.5.0_cvs, release/5.5.0, release/6.1.0_cvs, release/6.1.0, release/6.0.0_cvs, release/6.0.0, release/5.4.0_cvs, release/5.4.0, release/4.11.0_cvs, release/4.11.0, release/5.3.0_cvs, release/5.3.0, release/4.10.0_cvs, release/4.10.0, release/5.2.1_cvs, release/5.2.1, release/5.2.0_cvs, release/5.2.0, release/4.9.0_cvs, release/4.9.0, release/5.1.0_cvs, release/5.1.0 |
|
| #
f4203da8 |
| 28-May-2003 |
Max Khon <[email protected]> |
Fix stripping last path component when only one path component left.
PR: 52686 MFC after: 1 day
|
| #
d0509082 |
| 01-May-2003 |
Jacques Vidrine <[email protected]> |
Back out the `hiding' of strlcpy and strlcat. Several people vocally objected to this safety belt.
|
| #
5723e501 |
| 29-Apr-2003 |
Jacques Vidrine <[email protected]> |
`Hide' strlcpy and strlcat (using the namespace.h / __weak_reference technique) so that we don't wind up calling into an application's version if the application defines them.
Inspired by: qpopper's
`Hide' strlcpy and strlcat (using the namespace.h / __weak_reference technique) so that we don't wind up calling into an application's version if the application defines them.
Inspired by: qpopper's interfering and buggy version of strlcpy
show more ...
|
|
Revision tags: release/4.8.0_cvs, release/4.8.0 |
|
| #
839e119e |
| 29-Mar-2003 |
Max Khon <[email protected]> |
BDE'ify
|
| #
057e4034 |
| 29-Mar-2003 |
Max Khon <[email protected]> |
fix truncation check and buffer overflow check
|
| #
be6a158e |
| 28-Mar-2003 |
Max Khon <[email protected]> |
- MAXPATHLEN -> PATH_MAX (pass correct buffer size to readlink as well)
Requested by: bde
|