diff options
author | Theodore Ts'o <tytso@mit.edu> | 2005-05-20 23:10:35 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2005-05-20 23:10:35 -0400 |
commit | 8198e7912663eb13680391979bfb6177f478e9e0 (patch) | |
tree | 14e548e3ec17ec70675bf72512af4ca91fcf89fe | |
parent | ce1250c8415c040a4c25fdced2a2ae91ddfc3d6d (diff) | |
download | e2fsprogs-8198e7912663eb13680391979bfb6177f478e9e0.tar.gz |
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)
-rw-r--r-- | misc/ChangeLog | 8 | ||||
-rw-r--r-- | misc/filefrag.c | 9 |
2 files changed, 13 insertions, 4 deletions
diff --git a/misc/ChangeLog b/misc/ChangeLog index 55203950..1b2826e5 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -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 diff --git a/misc/filefrag.c b/misc/filefrag.c index 5364125c..d8e3754d 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; |