[vlc-devel] [PATCH 1/2] V4L2: Open devices only once.
Thierry Reding
thierry.reding at avionic-design.de
Thu Aug 4 13:12:52 CEST 2011
* Rémi Denis-Courmont wrote:
> On Thu, 4 Aug 2011 12:58:47 +0200, Thierry Reding
> <thierry.reding at avionic-design.de> wrote:
> >> > if( i_fd >= 0 ) v4l2_close( i_fd );
> >> > - return false;
> >> > + return VLC_EGENERIC;
> >>
> >> You really should use -1 for this.
> >
> > -1 is defined as VLC_ENOMEM. It's kind of a moot point because the return
> > value from InitVideoDev() is not used anyway.
>
> The point is, we always use -1 as the error value for file descriptors, as
> does POSIX.
>
> I'd rather not mix the file descriptors space with the VLC error codes
> space.
Okay. While at it, do you have any objections if I rewrite InitVideoDev() to
no longer close the file descriptor on failure and move the v4l2_close() call
to the error handling after the InitVideoDev() call?
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20110804/5f204393/attachment.sig>
More information about the vlc-devel
mailing list