From 437d89a15183a1b2ef66724360bd09a7ef7d9d71 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 22 Jan 2002 10:44:13 +0000 Subject: (skip): Use fseeko rather than lseek. (Also, check for overflow when converting uintmax_t to off_t.) --- src/od.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/od.c') diff --git a/src/od.c b/src/od.c index ad73bb252..a08a7a5a2 100644 --- a/src/od.c +++ b/src/od.c @@ -1081,7 +1081,10 @@ skip (uintmax_t n_skip) n_skip -= file_stats.st_size; else { - if (lseek (fileno (in_stream), n_skip, SEEK_CUR) < 0) + off_t offset = n_skip; + if (offset == n_skip && 0 <= offset + ? fseeko (in_stream, offset, SEEK_CUR) != 0 + : (errno = EOVERFLOW, 1)) { error (0, errno, "%s", input_filename); err = 1; -- cgit v1.2.3-54-g00ecf