PR: 250062
Details
- Reviewers
jilles ed emaste fbsd-phab_maskray.me - Group Reviewers
manpages - Commits
- rS366781: Implement ptsname_r.
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
lib/libc/stdlib/ptsname.c | ||
---|---|---|
82 ↗ | (On Diff #77803) | In musl and glibc, if buffer 0, ERANGE is returned. ioctl TIOCGPTN returns ERANGE so there is no need to do a user-space check. Does FreeBSD need the user-space check? |
87 ↗ | (On Diff #77803) | If buflen is smaller than sizeof(_PATH_DEV) but longer than the actual return value, I think ptsname_r should still return 0. |
118 ↗ | (On Diff #77803) | == 0? |
lib/libc/stdlib/ptsname.c | ||
---|---|---|
82 ↗ | (On Diff #77803) | Hmm, I've looked at the manual page and found that it's only returned for glibc < 2.25, so I'll drop this. The reference was: |
lib/libc/stdlib/ptsname.c | ||
---|---|---|
87 ↗ | (On Diff #77803) | We always prepend _PATH_DEV to the result, how does ptsname_r behave on e.g. Linux? |
Otherwise, seems alright!
lib/libc/stdlib/ptsname.3 | ||
---|---|---|
140 ↗ | (On Diff #77804) | Macros like Er do not expand here. It's much better to just put ERANGE here as the argument to width. |
This complies to https://www.austingroupbugs.net/bug_view_page.php?bug_id=508 which is planned for POSIX issue8 (in a few years).
Address reviewer comments;
Move width back to Er per suggestion from https://mandoc.bsd.lv/mdoc/details/width.html#Macro_default_widths .
lib/libc/stdlib/ptsname.3 | ||
---|---|---|
140 ↗ | (On Diff #77804) | It looks like it's the recommended practice at https://mandoc.bsd.lv/mdoc/details/width.html#Macro_default_widths (and observing the output, using "ERANGE" would make the description wrap into its own line) so I have changed it back. |