[MPlayer-dev-eng] Re: [PATCH] print appropriate error when failing to open a file

Alban Bedel albeu at free.fr
Tue Dec 13 16:14:49 CET 2005


On Tue, 13 Dec 2005 11:32:12 +0100
Dominik 'Rathann' Mierzejewski <dominik at rangers.eu.org> wrote:

> On Tuesday, 13 December 2005 at 04:17, Corey Hickey wrote:
> > MPlayer prints "File not found:" regardless of the actual reason it
> > fails to open() a file (access denied, etc.). The attached patch makes
> > MPlayer print a reason for every relevant error I found in 'man 2 open'.
> > 
> > I've tested as many of these as I can:
> > EACCES
> > ELOOP
> > ENAMETOOLONG
> > ENXIO
> > ENOENT
> > ENOTDIR
> > 
> > The rest should be fine, unless there are portability considerations I
> > don't know about.
> 
> These are supposed to be already translated in glibc, so we're basically
> duplicating their work. However, until we switch to gettext, I guess it's
> ok to leave it as you propose.

imho this is too specific. It would be better to implement something like
mp_strerror() and (for this particular case) use msg like:
"Failed to open %s: %s", file, mp_strerror(errno).
Such function would be more usefull overall as it could then be used in
lots of places where strerror() is already used.

	Albeu




More information about the MPlayer-dev-eng mailing list