Bug 75711 - [patch] opendir(3) missing ERRORS section
Summary: [patch] opendir(3) missing ERRORS section
Status: Open
Alias: None
Product: Documentation
Classification: Unclassified
Component: Manual Pages (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2005-01-01 21:20 UTC by abc
Modified: 2018-06-01 04:13 UTC (History)
1 user (show)

See Also:


Attachments
libc-gen-directory.3.diff (2.45 KB, patch)
2007-05-17 09:56 UTC, Jeroen Ruigrok van der Werven
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description abc 2005-01-01 21:20:15 UTC
opendir() manpage missing errno info.

Fix: 

state errno settings covering all functions in the manpage.
How-To-Repeat: man opendir(), only the closedir() info states errno settings.
Comment 1 Giorgos Keramidas freebsd_committer 2005-03-02 01:37:45 UTC
abc@ai1.anchorage.mtaonline.net wrote:
> man opendir(), only the closedir() info states errno settings.

The opendir() implementation in libc calls the following functions or
systems calls that may fail: close(), fcntl(), fstat(), malloc(),
mergesort(), open(), stat(), reallocf().

Should we document the join of all the possible errors these calls may
fail with in opendir()'s manpage?
Comment 2 abc 2005-03-02 03:49:15 UTC
> abc@ai1.anchorage.mtaonline.net wrote:
> > man opendir(), only the closedir() info states errno settings.

> The opendir() implementation in libc calls the following functions or
> systems calls that may fail: close(), fcntl(), fstat(), malloc(),
> mergesort(), open(), stat(), reallocf().

> Should we document the join of all the possible errors these calls may
> fail with in opendir()'s manpage?

the manpage should at LEAST state that it sets the
extern "errno", otherwise, it is assumed it doesn't,
and this assumption can easily result in programming
catastrophies.

if "errno" is not documented, and thus, not checked
for in a program, "errno" will get trapped by some
other function that does check for it.

all calls that may set "errno" should explicity
say so - so programmers can check for it after
a call.

thank you.
Comment 3 Giorgos Keramidas freebsd_committer 2005-03-03 17:31:18 UTC
Responsible Changed
From-To: freebsd-doc->keramida

I'll work on adding a proper ERRORS section to opendir(3).
Comment 4 Jeroen Ruigrok van der Werven 2007-05-17 09:56:51 UTC
Here's a patch that cleans up some of directory(3).
I've tested the errors and actually encountered a case where you can get
EFAULT returned from stat() since the call just passes along blindly a NULL
argument if you gave that to opendir() as dirname argument. Also attached is a
short-circuit for that case in libc/gen/diropen.c. I think it makes sense to
return ENOENT for that case since it fits the description.
I've also renamed filename to dirname to more accurately reflect what the call
operates on.
For the wording of the added text I used the SUS texts, since I understand we
have permission to do that nowadays.

This manual page will need further cleanups, most likely resulting in the
splitting of some calls to their own pages to keep the layout sane enough to
follow.

Please add a [patch] in front of the PR's synopsis.

-- 
Jeroen Ruigrok van der Werven <asmodai(-at-)in-nomine.org> / asmodai
ã¤ã§ã«ã¼ã³ ã©ã¦ãã­ã㯠ã´ã¡ã³ ãã« ã¦ã§ã«ã´ã§ã³
http://www.in-nomine.org/ | http://www.rangaku.org/
All conditioned things are impermanent. Work out your own salvation with
diligence...
Comment 5 Mark Linimon freebsd_committer freebsd_triage 2015-03-10 03:06:36 UTC
Release to wild.