From 8198e7912663eb13680391979bfb6177f478e9e0 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Fri, 20 May 2005 23:10:35 -0400 Subject: [PATCH] filefrag.c (frag_report, get_bmap): The FIBMAP and FIGETBSZ ioctls return an integer, not an unsigned long. Fix this to avoid problems on 64-bit platforms where the size of an integer != the size of a long. (Addresses Debian Bug #309655) --- misc/ChangeLog | 8 ++++++++ misc/filefrag.c | 9 +++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/misc/ChangeLog b/misc/ChangeLog index 5520395..1b2826e 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,11 @@ +2005-05-20 Theodore Ts'o + + * filefrag.c (frag_report, get_bmap): The FIBMAP and FIGETBSZ + ioctls return an integer, not an unsigned long. Fix this + to avoid problems on 64-bit platforms where the size of an + integer != the size of a long. (Addresses Debian Bug + #309655) + 2005-05-09 Theodore Ts'o * util.c (figure_journal_size): Change the default journal size to diff --git a/misc/filefrag.c b/misc/filefrag.c index 5364125..d8e3754 100644 --- a/misc/filefrag.c +++ b/misc/filefrag.c @@ -50,10 +50,10 @@ int verbose = 0; static unsigned long get_bmap(int fd, unsigned long block) { int ret; - unsigned long b; + unsigned int b; b = block; - ret = ioctl(fd, FIBMAP, &b); + ret = ioctl(fd, FIBMAP, &b); /* FIBMAP takes a pointer to an integer */ if (ret < 0) { if (errno == EPERM) { fprintf(stderr, "No permission to use FIBMAP ioctl; must have root privileges\n"); @@ -70,7 +70,8 @@ static void frag_report(const char *filename) { struct statfs fsinfo; struct stat64 fileinfo; - long i, fd, bs, block, last_block = 0, numblocks; + int bs; + long i, fd, block, last_block = 0, numblocks; long bpib; /* Blocks per indirect block */ long cylgroups; int discont = 0, expected; @@ -105,7 +106,7 @@ static void frag_report(const char *filename) perror("open"); return; } - if (ioctl(fd, FIGETBSZ, &bs) < 0) { + if (ioctl(fd, FIGETBSZ, &bs) < 0) { /* FIGETBSZ takes an int */ perror("FIGETBSZ"); close(fd); return; -- 1.8.3.1