mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Jorge Almeida <jjalmeida@gmail.com>
To: musl@lists.openwall.com
Subject: Re: closedir()
Date: Fri, 1 Feb 2019 01:03:17 +0000	[thread overview]
Message-ID: <CAKpSnpKVrCe8uo+vJcxtwWk7GXF9-qk-53YvR7DDi4n3=WkrJQ@mail.gmail.com> (raw)
In-Reply-To: <20190201002716.GK23599@brightrain.aerifal.cx>

On Fri, Feb 1, 2019 at 12:27 AM Rich Felker <dalias@libc.org> wrote:
>
> On Thu, Jan 31, 2019 at 09:58:06PM +0000, De Paula, Judah wrote:

> > http://man7.org/linux/man-pages/man3/closedir.3.html
>
> Hi,
>
> Passing an invalid pointer to closedir is undefined behavior, and in
> musl the preferred effect for undefined behavior when it's not costly
> to attempt to detect is a quick crash so that the point of error in
> the program can be identified and fixed.
>

Is there a standard that says it is undefined behavior? According to
the man page quoted by the OP, and also according to
http://pubs.opengroup.org/onlinepubs/007904975/functions/closedir.html,
it should return -1 and set errno to EBADF.
Some of us _do_ check return codes. Getting a segfault doesn't seem
more helpful than a message saying which function failed and why. As
an amateur, I'm just trying to figure out what to do when I need to
use a function I'm not very familiar with. Reading the manual seems
pointless. Can you suggest a reliable, accessible source of
information?

Thanks,

Jorge Almeida


  reply	other threads:[~2019-02-01  1:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-31 21:58 closedir() De Paula, Judah
2019-02-01  0:27 ` closedir() Rich Felker
2019-02-01  1:03   ` Jorge Almeida [this message]
2019-02-01  2:30     ` closedir() Rich Felker
2019-02-01  9:34       ` closedir() Jorge Almeida

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKpSnpKVrCe8uo+vJcxtwWk7GXF9-qk-53YvR7DDi4n3=WkrJQ@mail.gmail.com' \
    --to=jjalmeida@gmail.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).