aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-11-17 18:26:25 +0000
committerGravatar reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-11-17 18:26:25 +0000
commit17a2278031d0c6cd44c8778126d22552f1f2eb84 (patch)
tree764a67c6ebae676d4c779dbbceb50e073b53c0cb
parented3b33cf032c8bafd221ef59c35c37c2c899ea02 (diff)
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
-rw-r--r--stream/stream_dvd.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c
index cc831b5f96..b3c87a108d 100644
--- a/stream/stream_dvd.c
+++ b/stream/stream_dvd.c
@@ -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