Whamcloud - gitweb
badblocks.c (pattern_fill): Fix bug accidentally added when
authorTheodore Ts'o <tytso@mit.edu>
Fri, 27 Feb 2004 02:06:58 +0000 (21:06 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 27 Feb 2004 02:06:58 +0000 (21:06 -0500)
fixing up gcc -Wall nits.  badblocks -t random was not
getting handled properly because ~0 needed to be cast to
an unsigned long instead of an unsigned char.  (Addresses
Debian bug #234828)

misc/ChangeLog
misc/badblocks.c

index de05ed0..bf5d709 100644 (file)
@@ -1,3 +1,11 @@
+2004-02-26  Theodore Ts'o  <tytso@mit.edu>
+
+       * badblocks.c (pattern_fill): Fix bug accidentally added when
+               fixing up gcc -Wall nits.  badblocks -t random was not
+               getting handled properly because ~0 needed to be cast to
+               an unsigned long instead of an unsigned char.  (Addresses
+               Debian bug #234828)
+
 2004-02-21  Theodore Ts'o  <tytso@mit.edu>
 
        * fsck.c (execute): Use '&&' instead of '&'.  (It didn't cause a
index 2c5e17e..3a23060 100644 (file)
@@ -219,7 +219,7 @@ static void pattern_fill(unsigned char *buffer, unsigned long pattern,
        unsigned int    i, nb;
        unsigned char   bpattern[sizeof(pattern)], *ptr;
        
-       if (pattern == (unsigned char) ~0) {
+       if (pattern == (unsigned long) ~0) {
                for (ptr = buffer; ptr < buffer + n; ptr++) {
                        (*ptr) = random() % (1 << (8 * sizeof(char)));
                }