called for multiple passes.
(test_nd): Fix bug in chosing randomness for the
non-destructive test. We were only using 1 bit of
randomness per byte instead of 8 due to a bit-shift bug.
Also, initialize the random number generator from the time
in main(). Thanks to Thayne Harbaugh for pointing out
these bugs.
+2003-05-07 Theodore Ts'o <tytso@mit.edu>
+
+ * badblocks.c (test_rw): Fix minor memory leak with test_rw() is
+ called for multiple passes.
+ (test_nd): Fix bug in chosing randomness for the
+ non-destructive test. We were only using 1 bit of
+ randomness per byte instead of 8 due to a bit-shift bug.
+ Also, initialize the random number generator from the time
+ in main(). Thanks to Thayne Harbaugh for pointing out
+ these bugs.
+
2003-05-05 Theodore Ts'o <tytso@mit.edu>
* tune2fs.c (main, add_journal_device, remove_journal_device): If
#include <string.h>
#include <unistd.h>
#include <setjmp.h>
+#include <time.h>
#include <sys/ioctl.h>
#include <sys/types.h>
flush_bufs();
}
+ free(buffer);
return bb_count;
}
for(ptr = blkbuf + blocks_at_once * block_size;
ptr < blkbuf + 2 * blocks_at_once * block_size;
++ptr) {
- (*ptr) = random() % (1 << sizeof(char));
+ (*ptr) = random() % (1 << (8 * sizeof(char)));
}
flush_bufs();
bindtextdomain(NLS_CAT_NAME, LOCALEDIR);
textdomain(NLS_CAT_NAME);
#endif
+ srandom((unsigned int)time(NULL)); /* simple randomness is enough */
test_func = test_ro;
if (argc && *argv)