Whamcloud - gitweb
Use ext2_loff_t instead of loff_t
authorTheodore Ts'o <tytso@mit.edu>
Mon, 23 Mar 2020 03:30:14 +0000 (23:30 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 24 Mar 2020 01:21:00 +0000 (21:21 -0400)
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 <tytso@mit.edu>
Reported-by: Matthias Andree <matthias.andree@gmx.de>
lib/ext2fs/imager.c
misc/e2fuzz.c

index b3ede9a..1aebe62 100644 (file)
@@ -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)
index 7c0f776..685cdbe 100644 (file)
@@ -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);