[vlc-devel] vlc_loaddir always falis on Mac OSX

Rémi Denis-Courmont remi at remlab.net
Tue Oct 11 10:56:18 CEST 2011


On Tue, 11 Oct 2011 17:40:03 +0900, Naohiro KORIYAMA <nkoriyama at gmail.com>
wrote:
>> Yes, the bug must be somewhere else or ,,,. but it exists no doubt on
>> Mac.
>> Everywhere using vlc_readdir(), fpathconf always renturns -1 and errno
>> = EBADF(9).

If that's true, then it looks like a bug in MacOS.

>> Here is full log from starting vlc and exiting vlc not only lua part.
>> a little bit long and contains Japanese characters UTF-8.
>> http://dl.dropbox.com/u/7574919/vlc_all.log
>>
> 
> I wonder why only vlc_loaddir looks errno when vlc_readdir returns NULL.

As I said earlier, errno is how we differentiate real bad I/O errors from
normal end of directory listing. This is required to implement
(vlc_)scandir() is confirming way. In both cases, (vlc_)readdir() returns
NULL, so errno is the only way to detect errors.

> I grep the whole and found the code that using vlc_readdir.

> These part of code are all not check the errno.

Mostly because it's easier not to care about errors. That does not mean
it's a good thing.

> Just a reminder. I don't say that it's better to ignore the error.

The point is, scandir() is specified w.r.t. error handling. It would be
extremely confusing for vlc_scandir() not to behave like scandir(). We have
had some problems in the past where VLC helper functions behaved in
peculiar ways, causing developers to make wrong assumptions and introducing
bugs.

-- 
Rémi Denis-Courmont
http://www.remlab.net/



More information about the vlc-devel mailing list