strerror.3: Add an example for perror() This is a nice and quick reference.
Details
Details
- Reviewers
yuripv jilles - Group Reviewers
manpages - Commits
- rS368714: strerror.3: Add an example for perror()
Diff Detail
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
lib/libc/string/strerror.3 | ||
---|---|---|
158 ↗ | (On Diff #80725) |
Comment Actions
@yuripv, let me know if that's a nice addition to the manual page or not. :) I understand it's basic stuff, but I feel like it's nice to show common patterns in a manual for reference.
Comment Actions
not sure, both works for me.
p.s. as you mentioned err(3), i think there an error in "Warn of an error" example -- second one uses err().
lib/libc/string/strerror.3 | ||
---|---|---|
161 ↗ | (On Diff #80727) | This is not a great example since it is undefined behaviour. In fact, before FreeBSD 11.0, this caused a segmentation fault instead of an error return. Perhaps a better example is fd = open("/dev/null/wrong", O_RDONLY); which will fail with Not a directory. |
lib/libc/string/strerror.3 | ||
---|---|---|
161 ↗ | (On Diff #80727) | Ha, fascinating! Thanks a lot, I'll update the revision shortly. |