From 27e8d4856f34f4f4434bd15b88a1ad7ee0f2b147 Mon Sep 17 00:00:00 2001 From: rocky Date: Sat, 22 Jan 2005 11:22:00 +0000 Subject: [PATCH] Don't attempt to see before the beginning of a file. --- lib/driver/_cdio_stream.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/driver/_cdio_stream.c b/lib/driver/_cdio_stream.c index 84bcd901..3416522d 100644 --- a/lib/driver/_cdio_stream.c +++ b/lib/driver/_cdio_stream.c @@ -1,7 +1,8 @@ /* - $Id: _cdio_stream.c,v 1.3 2005/01/21 10:11:24 rocky Exp $ + $Id: _cdio_stream.c,v 1.4 2005/01/22 11:22:00 rocky Exp $ Copyright (C) 2000, 2004, 2005 Herbert Valerio Riedel + Copyright (C) 2005 Rocky Bernstein This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -34,7 +35,7 @@ #include #include "_cdio_stream.h" -static const char _rcsid[] = "$Id: _cdio_stream.c,v 1.3 2005/01/21 10:11:24 rocky Exp $"; +static const char _rcsid[] = "$Id: _cdio_stream.c,v 1.4 2005/01/22 11:22:00 rocky Exp $"; /* * DataSource implementations @@ -86,7 +87,7 @@ _cdio_stream_open_if_necessary(CdioDataSource_t *p_obj) Otherwise, -1 is returned and the global variable errno is set to indi- cate the error. */ -long +long int cdio_stream_seek(CdioDataSource_t* p_obj, long int offset, int whence) { if (!p_obj) return -1; @@ -95,6 +96,8 @@ cdio_stream_seek(CdioDataSource_t* p_obj, long int offset, int whence) /* errno is set by _cdio_stream_open_if necessary. */ return -1; + if (offset < 0) return -1; + if (p_obj->position != offset) { #ifdef STREAM_DEBUG cdio_warn("had to reposition DataSource from %ld to %ld!", obj->position, offset);