From 1df6a455505b483bd493acb97be9c4c719064700 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sun, 22 Mar 2020 23:30:14 -0400 Subject: [PATCH] Use ext2_loff_t instead of loff_t The loff_t type is a glibc'ism and is not fully portable. Use ext2_loff_t instead. Fixes: 382ed4a1c2b6 ("e2fsck: use proper types for variables") Signed-off-by: Theodore Ts'o Reported-by: Matthias Andree --- lib/ext2fs/imager.c | 2 +- misc/e2fuzz.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/ext2fs/imager.c b/lib/ext2fs/imager.c index b3ede9a..1aebe62 100644 --- a/lib/ext2fs/imager.c +++ b/lib/ext2fs/imager.c @@ -67,7 +67,7 @@ errcode_t ext2fs_image_inode_write(ext2_filsys fs, int fd, int flags) blk64_t blk; ssize_t actual; errcode_t retval; - loff_t r; + ext2_loff_t r; buf = malloc(fs->blocksize * BUF_BLOCKS); if (!buf) diff --git a/misc/e2fuzz.c b/misc/e2fuzz.c index 7c0f776..685cdbe 100644 --- a/misc/e2fuzz.c +++ b/misc/e2fuzz.c @@ -33,9 +33,10 @@ static unsigned long long user_corrupt_bytes = 0; static double user_corrupt_pct = 0.0; #if !defined HAVE_PWRITE64 && !defined HAVE_PWRITE -static ssize_t my_pwrite(int fd, const void *buf, size_t count, off_t offset) +static ssize_t my_pwrite(int fd, const void *buf, size_t count, + ext2_loff_t offset) { - if (lseek(fd, offset, SEEK_SET) < 0) + if (ext2fs_llseek(fd, offset, SEEK_SET) < 0) return 0; return write(fd, buf, count); @@ -82,7 +83,7 @@ static int find_block_helper(ext2_filsys fs EXT2FS_ATTR((unused)), } static errcode_t find_metadata_blocks(ext2_filsys fs, ext2fs_block_bitmap bmap, - off_t *corrupt_bytes) + ext2_loff_t *corrupt_bytes) { dgrp_t i; blk64_t b, c; @@ -181,9 +182,8 @@ static int process_fs(const char *fsname) int flags, fd; ext2_filsys fs = NULL; ext2fs_block_bitmap corrupt_map; - loff_t hsize, count, off, offset, corrupt_bytes; + ext2_loff_t hsize, count, off, offset, corrupt_bytes, i; unsigned char c; - loff_t i; /* If mounted rw, force dryrun mode */ ret = ext2fs_check_if_mounted(fsname, &flags); -- 1.8.3.1