Opened 19 years ago

Closed 19 years ago

Last modified 19 years ago

#260 closed defect (fixed)

EBADF when opening vcd fails

Reported by: pawel@… Owned by: moritz@…
Priority: normal Component: demuxer
Version: 1.0pre6 Severity: minor
Keywords: Cc:
Blocked By: Blocking:
Reproduced by developer: no Analyzed by developer: no

Description

When mplayer fails to open a VCD (because it's not available), the strace ends with:

open("/dev/cdrom", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
write(2, "CD-ROM Device \'/dev/cdrom\' not f"..., 38CD-ROM Device '/dev/cdrom'
not found.
) = 38
close(-1) = -1 EBADF (Bad file descriptor)

Which is caused by (sed -n 89,92p libmpdemux/stream_vcd.c):

f=open(p->device,O_RDONLY);
if(f<0){

mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CdDevNotfound,p->device);
close(f);

You shouldn't close f if it doesn't refer to an open file descriptor (here being
-1).

Attachments (1)

mplayer-vcd-close.patch (376 bytes ) - added by Dominik 'Rathann' Mierzejewski 19 years ago.
fix: Don't try to close an fd that failed to open.

Download all attachments as: .zip

Change History (4)

comment:1 by Dominik 'Rathann' Mierzejewski, 19 years ago

Attached trivial patch to fix that.

by Dominik 'Rathann' Mierzejewski, 19 years ago

Attachment: mplayer-vcd-close.patch added

fix: Don't try to close an fd that failed to open.

comment:2 by Dominik 'Rathann' Mierzejewski, 19 years ago

comment:3 by Dominik 'Rathann' Mierzejewski, 19 years ago

Resolution: fixed
Status: newclosed

Fixed in CVS.

Note: See TracTickets for help on using tickets.