[DVDnav-discuss] [PATCH] Only -1 as open() return value indicates error
Erik Hovland
erik at hovland.org
Tue Nov 6 19:40:50 CET 2012
A similar fix was committed to my tree about a year ago.
Let me know if it works for you. I intend to push that change
to mplayerhq svn as soon as I can.
Thanks
E
On Tue, Nov 6, 2012 at 10:21 AM, Reimar Döffinger
<Reimar.Doeffinger at gmx.de> wrote:
> Hello,
> mostly purely theoretical, but we might get 0 as fd from open.
> I used the exact -1 check, because e.g. WinCE will also use other
> negative value as file descriptors (it basically just uses memory
> pointers cast to int as far as I know) and I don't see a good reason
> to check for >= 0 instead.
>
> Index: vm/vm.c
> ===================================================================
> --- vm/vm.c (revision 1243)
> +++ vm/vm.c (working copy)
> @@ -172,7 +172,7 @@
>
> /* Read DVD name */
> fd = open(device, O_RDONLY);
> - if (fd > 0) {
> + if (fd != -1) {
> off = lseek( fd, 32 * (off_t) DVD_VIDEO_LB_LEN, SEEK_SET );
> if( off == ( 32 * (off_t) DVD_VIDEO_LB_LEN ) ) {
> off = read( fd, data, DVD_VIDEO_LB_LEN );
>
> _______________________________________________
> DVDnav-discuss mailing list
> DVDnav-discuss at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/dvdnav-discuss
--
Erik Hovland
erik at hovland.org
http://hovland.org/
More information about the DVDnav-discuss
mailing list