Opened 15 years ago

Closed 14 years ago

Last modified 14 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: Analyzed by developer:

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@… 15 years ago.
fix: Don't try to close an fd that failed to open.

Download all attachments as: .zip

Change History (4)

comment:1 Changed 15 years ago by dominik@…

Attached trivial patch to fix that.

Changed 15 years ago by dominik@…

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

comment:2 Changed 15 years ago by dominik@…

comment:3 Changed 14 years ago by dominik@…

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in CVS.

Note: See TracTickets for help on using tickets.