<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libc, branch release/14.4.0</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src/atom?h=release%2F14.4.0</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src/atom?h=release%2F14.4.0'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/'/>
<updated>2026-02-05T14:50:01Z</updated>
<entry>
<title>libc/tests: Clean up *dir() tests</title>
<updated>2026-02-05T14:50:01Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-02-03T14:39:21Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=0018cfdb91c399342a0facd04dfe72cb689d86ea'/>
<id>urn:sha1:0018cfdb91c399342a0facd04dfe72cb689d86ea</id>
<content type='text'>
Mainly, avoid reusing the name of one of the functions we should be
testing (but aren't) for local variables.

Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D55054

(cherry picked from commit d70b9eb74fc4aa430bd2ff4bca37e6a9b6c8004f)
</content>
</entry>
<entry>
<title>libc: Improve POSIX conformance of dirfd()</title>
<updated>2026-02-05T14:48:36Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-02-02T15:46:57Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=77dedead8539c76d1f452c2c0073ee13ed7cf54a'/>
<id>urn:sha1:77dedead8539c76d1f452c2c0073ee13ed7cf54a</id>
<content type='text'>
POSIX states that dirfd() should set errno to EINVAL and return -1 if
dirp does not refer to a valid directory stream.  Our interpretation is
that this applies if dirp is null or the file descriptor associated
with it is negative.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D55025

(cherry picked from commit 5074d5c9845e142883cdbb9ad212be66e57615d0)

libc: Fix missing include

Although not needed on FreeBSD due to namespace pollution, we should
technically #include &lt;stddef.h&gt; to secure a definition of NULL.

Fixes:		5074d5c9845e ("libc: Improve POSIX conformance of dirfd()")
(cherry picked from commit 1c00d5a3b234ef937d848956027e9de5ea8010f9)
</content>
</entry>
<entry>
<title>libc: Clean up *dir() code</title>
<updated>2026-02-05T14:48:36Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2026-02-02T15:46:53Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=b614c9893fa38771075d1f329763a0151b53b86d'/>
<id>urn:sha1:b614c9893fa38771075d1f329763a0151b53b86d</id>
<content type='text'>
Fix style nits (mostly whitespace issues) and clean up the manual page.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D55024

(cherry picked from commit 387ae6390534b6e9b48931840e7bc76eeb0b258d)
</content>
</entry>
<entry>
<title>opendir, readdir, telldir: Use the correct types.</title>
<updated>2026-02-05T14:48:34Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-07-09T20:34:22Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=98b041239c252d0c2433e5d412d74f90a235d0f2'/>
<id>urn:sha1:98b041239c252d0c2433e5d412d74f90a235d0f2</id>
<content type='text'>
Use either size_t or off_t (as appropriate) instead of long.

Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D51210

(cherry picked from commit 42e613018da50ee6877d24815c7626d79629e707)

readdir: Fix error check.

Now that dd_size is unsigned, we need to check if the return value from
getdirentries() was negative before assigning it to dd_size.

While here, simplify the scandir_error test case slightly, and verify
that calling readdir() again after EOF still returns NULL.

Fixes:		42e613018da5
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D51266

(cherry picked from commit 920b2183919e430cf85c4aa1fa337bfded12aee5)
</content>
</entry>
<entry>
<title>opendir, fdopendir: Add tests, clean up.</title>
<updated>2026-02-05T14:47:47Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-07-08T19:40:55Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=9d7a0f817cef4c7d94fe584f3f85754996678ed4'/>
<id>urn:sha1:9d7a0f817cef4c7d94fe584f3f85754996678ed4</id>
<content type='text'>
* Add test cases for opendir() and fdopendir().
* Drop O_NONBLOCK from opendir(); it was added a long time ago to avoid
  blocking if given a closed named pipe, but now we use O_DIRECTORY,
  which ensures that we get ENOTDIR in that case.
* While here, remove unused #includes left over from the split.

Sponsored by:	Klara, Inc.
Reviewed by:	kevans, markj
Differential Revision:	https://reviews.freebsd.org/D51126

(cherry picked from commit c08e019c6ce4fc637b195f1bb0878763c3fefe9e)
</content>
</entry>
<entry>
<title>opendir: Simplify is_unionstack().</title>
<updated>2026-02-05T14:47:47Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-07-02T10:22:21Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=b10a31f4e0f43857f63390a451857fb3c733e26f'/>
<id>urn:sha1:b10a31f4e0f43857f63390a451857fb3c733e26f</id>
<content type='text'>
Sponsored by:	Klara, Inc.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D51118

(cherry picked from commit 5e96f4006d2e5f165531a53b6c1393a1c7604f42)
</content>
</entry>
<entry>
<title>scandir: Code cleanup.</title>
<updated>2026-02-05T14:47:46Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-06-26T07:37:06Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=d2f8f53385b3f2b42e38c387cb1ccba4518167e9'/>
<id>urn:sha1:d2f8f53385b3f2b42e38c387cb1ccba4518167e9</id>
<content type='text'>
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D51050

(cherry picked from commit 8ebc0768663b0ea9f78a0b8cffb93ee1684a9b08)
</content>
</entry>
<entry>
<title>scandir: Propagate errors from readdir().</title>
<updated>2026-02-05T14:47:46Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-06-26T07:37:00Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=1a3c32bac0f029b0186bb856373fe3bcd2d5e18f'/>
<id>urn:sha1:1a3c32bac0f029b0186bb856373fe3bcd2d5e18f</id>
<content type='text'>
Currently, if `readdir()` fails, `scandir()` simply returns a partial
result (or a null result if it fails before any entries were selected).
There is no way within the current API design to return both a partial
result and an error indicator, so err on the side of caution: if an
error occurs, discard any partial result and return the error instead.

MFC after:	1 week
Reported by:	Maxim Suhanov &lt;dfirblog@gmail.com&gt;
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D51046

(cherry picked from commit 62e0f12f5104585b7346fee183e5c667b39ddbad)
</content>
</entry>
<entry>
<title>libc: Rename fscandir{,_b}() to fdscandir{,_b}().</title>
<updated>2026-02-05T14:47:46Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-06-23T13:02:53Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=35f8b56a41230f5c0853c2e096af72e9e65fa0e5'/>
<id>urn:sha1:35f8b56a41230f5c0853c2e096af72e9e65fa0e5</id>
<content type='text'>
This seems to fit the pattern better (e.g. fdopendir()).

I've added weak references to ease the transition, but since it's only
been a few days, we can remove them (and the ObsoleteFiles entries for
the manual pages) before we branch stable/15.

Fixes:		deeebfdecab5
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D50980

(cherry picked from commit 0a5b763d98b921f921243525ff25a70bbe00cfaa)

libc: Finish removing fscandir{,_b}().

These only existed for a few days before being renamed, so there's no
reason to continue to carry compatibility shims for them.

Fixes:		deeebfdecab5
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D50981

(cherry picked from commit ccf937320a1a7383a2c33698007b7244f66dc022)
</content>
</entry>
<entry>
<title>scandir: Fix behavior when no entries match.</title>
<updated>2026-02-05T14:47:46Z</updated>
<author>
<name>Dag-Erling Smørgrav</name>
<email>des@FreeBSD.org</email>
</author>
<published>2025-06-20T16:13:48Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=90c5d1b5f4238823414a82b72e7f80d9e83a3de6'/>
<id>urn:sha1:90c5d1b5f4238823414a82b72e7f80d9e83a3de6</id>
<content type='text'>
In the previous commit, I removed the initial initialization of the
`names` array, not realizing that `scandir()` is expected to return
a non-null (but empty) array of entries if no entries matched.
Restore the historical behavior, document it, and add a test.

Fixes:		deeebfdecab5
Sponsored by:	Klara, Inc.
Reviewed by:	kevans, allanjude, markj
Differential Revision:	https://reviews.freebsd.org/D50949

(cherry picked from commit c187b673bb79905b5d5db1eb34d5a893c4464eeb)
</content>
</entry>
</feed>
