From e723efae2fcbfa501639fb6909ed0e8a662e79b8 Mon Sep 17 00:00:00 2001 From: Juergen Keil Date: Fri, 5 Oct 2001 17:36:28 +0000 Subject: Errors returned from read(2) system call were ignored in most input plugins (e.g. when accessing an encrypted dvd without proper dvd drive authentication). Print error messages, and try to handle read errors. CVS patchset: 741 CVS date: 2001/10/05 17:36:28 --- src/input/input_dvd.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/input/input_dvd.c') diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index c22031a1d..2835b045d 100644 --- a/src/input/input_dvd.c +++ b/src/input/input_dvd.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_dvd.c,v 1.27 2001/10/05 14:49:32 heikos Exp $ + * $Id: input_dvd.c,v 1.28 2001/10/05 17:36:28 jkeil Exp $ */ #ifdef HAVE_CONFIG_H @@ -252,6 +252,7 @@ static off_t dvd_plugin_read (input_plugin_t *this_gen, char *buf, off_t nlen) { dvd_input_plugin_t *this = (dvd_input_plugin_t *) this_gen; + int bytes_read; if (nlen != DVD_VIDEO_LB_LEN) { @@ -264,15 +265,19 @@ static off_t dvd_plugin_read (input_plugin_t *this_gen, if (this->file_size_left < nlen) return 0; - if (read (this->raw_fd, buf, DVD_VIDEO_LB_LEN)) { + bytes_read = read (this->raw_fd, buf, DVD_VIDEO_LB_LEN); + if (bytes_read == DVD_VIDEO_LB_LEN) { this->file_lbcur++; this->file_size_left -= DVD_VIDEO_LB_LEN; return DVD_VIDEO_LB_LEN; - } else - fprintf (stderr, "read error in input_dvd plugin\n"); - + } else if (bytes_read < 0) + fprintf (stderr, "read error in input_dvd plugin (%s)\n", + strerror (errno)); + else + fprintf (stderr, "short read in input_dvd (%d != %d)\n", + bytes_read, DVD_VIDEO_LB_LEN); return 0; } -- cgit v1.2.3