summaryrefslogtreecommitdiff
path: root/src/dd.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-09-14 09:12:13 +0000
committerJim Meyering <jim@meyering.net>2002-09-14 09:12:13 +0000
commit3935842cb3b6213f03dc526098c6bda1524be6d4 (patch)
tree9ce82f37ff9c926770a99d0edad325af8cf01c05 /src/dd.c
parent12b5bb320c15b174809fe5d879c1b5c5cb61ebe0 (diff)
downloadcoreutils-3935842cb3b6213f03dc526098c6bda1524be6d4.tar.xz
(main, skip): Add casts to avoid warnings about
`comparison between signed and unsigned'.
Diffstat (limited to 'src/dd.c')
-rw-r--r--src/dd.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/dd.c b/src/dd.c
index d082c3442..e81fe7a9c 100644
--- a/src/dd.c
+++ b/src/dd.c
@@ -800,10 +800,11 @@ skip (int fdesc, char const *file, uintmax_t records, size_t blocksize,
{
off_t offset = records * blocksize;
- /* Try lseek and if an error indicates it was an inappropriate
- operation, fall back on using read. */
+ /* Try lseek and if an error indicates it was an inappropriate operation --
+ or if the the file offset is not representable as an off_t --
+ fall back on using read. */
- if (offset / blocksize != records
+ if ((uintmax_t) offset / blocksize != records
|| skip_via_lseek (file, fdesc, offset, SEEK_CUR) < 0)
{
while (records--)
@@ -1190,11 +1191,12 @@ main (int argc, char **argv)
{
struct stat stdout_stat;
off_t o = seek_records * output_blocksize;
- if (o / output_blocksize != seek_records)
+ if ((uintmax_t) o / output_blocksize != seek_records)
error (EXIT_FAILURE, 0, _("file offset out of range"));
if (fstat (STDOUT_FILENO, &stdout_stat) != 0)
- error (EXIT_FAILURE, errno, _("cannot fstat %s"), quote (output_file));
+ error (EXIT_FAILURE, errno, _("cannot fstat %s"),
+ quote (output_file));
/* Complain only when ftruncate fails on a regular file, a
directory, or a shared memory object, as the 2000-08