#260 closed defect (fixed)
EBADF when opening vcd fails
| Reported by: | Owned by: | ||
|---|---|---|---|
| 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)
Change History (4)
comment:1 by , 21 years ago
by , 21 years ago
| Attachment: | mplayer-vcd-close.patch added |
|---|
fix: Don't try to close an fd that failed to open.

Attached trivial patch to fix that.