1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-17 20:34:58 +00:00

Open device file only right before we need it, so we do not

have to add close to all the abort code-paths


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25068 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2007-11-17 18:26:25 +00:00
parent ed3b33cf03
commit 17a2278031

View File

@ -65,11 +65,6 @@ static void dvd_set_speed(char *device, unsigned speed)
if (!S_ISBLK(st.st_mode)) return; /* not a block device */
if ((fd = open(device, O_RDWR | O_NONBLOCK)) == -1) {
mp_msg(MSGT_OPEN, MSGL_INFO, MSGTR_DVDspeedCantOpen);
return;
}
if (speed < 100) { /* speed times 1350KB/s (DVD single speed) */
speed *= 1350;
}
@ -114,6 +109,11 @@ static void dvd_set_speed(char *device, unsigned speed)
AV_WB16(buffer + 18, 1000);
AV_WB16(buffer + 26, 1000);
if ((fd = open(device, O_RDWR | O_NONBLOCK)) == -1) {
mp_msg(MSGT_OPEN, MSGL_INFO, MSGTR_DVDspeedCantOpen);
return;
}
if (ioctl(fd, SG_IO, &sghdr) < 0) {
mp_msg(MSGT_OPEN, MSGL_INFO, MSGTR_DVDlimitFail);
} else