Whamcloud - gitweb
filefrag.c (frag_report, get_bmap): The FIBMAP and FIGETBSZ ioctls return
authorTheodore Ts'o <tytso@mit.edu>
Sat, 21 May 2005 03:10:35 +0000 (23:10 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 21 May 2005 03:10:35 +0000 (23:10 -0400)
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
misc/filefrag.c

index 5520395..1b2826e 100644 (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
index 5364125..d8e3754 100644 (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;