|
Message-ID: <CAKpSnpKVrCe8uo+vJcxtwWk7GXF9-qk-53YvR7DDi4n3=WkrJQ@mail.gmail.com> Date: Fri, 1 Feb 2019 01:03:17 +0000 From: Jorge Almeida <jjalmeida@...il.com> To: musl@...ts.openwall.com Subject: Re: closedir() On Fri, Feb 1, 2019 at 12:27 AM Rich Felker <dalias@...c.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
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.