Fixed overflow for attempts to seek to offsets > ULONG_MAX. See the

OpenBSD version for more complete fixes.  E.g., to seek to offsets >
INT_MAX using a block size of 1, block numbers need to be off_t's
instead of u_long's.
This commit is contained in:
Bruce Evans 1997-04-30 17:51:29 +00:00
parent 409ac84cb2
commit 3e75bb9be1

View File

@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id$
* $Id: position.c,v 1.5 1997/02/22 14:02:48 peter Exp $
*/
#ifndef lint
@ -67,7 +67,7 @@ pos_in()
/* If not a character, pipe or tape device, try to seek on it. */
if (!(in.flags & (ISCHR|ISPIPE|ISTAPE))) {
if (lseek(in.fd, (off_t)(in.offset * in.dbsz), SEEK_CUR) == -1)
if (lseek(in.fd, (off_t)in.offset * in.dbsz, SEEK_CUR) == -1)
err(1, "%s", in.name);
return;
}