Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 1 Feb 2019 01:03:17 +0000
From: Jorge Almeida <>
Subject: Re: closedir()

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

> >
> 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,
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


Jorge Almeida

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.