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)
bitmap-optimize
Theodore Ts'o 2005-05-20 23:10:35 -04:00
parent ce1250c841
commit 8198e79126
2 changed files with 13 additions and 4 deletions

View File

@ -1,3 +1,11 @@
2005-05-20 Theodore Ts'o <tytso@mit.edu>
* 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 <tytso@mit.edu>
* util.c (figure_journal_size): Change the default journal size to

View File

@ -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;