fsck_ffs(8): fix divide by zero when debug messages are enabled
Only print buffer cache debug message when a cache lookup has been done. When running `fsck_ffs -d` on a gjournal'ed filesystem, it's possible that totalreads is greater than zero when no cache lookup has been done - causing a divide by zero. This commit fixes the following error: Floating point exception (core dumped) Reviewed by: mckusick Differential Revision: https://reviews.freebsd.org/D30370
This commit is contained in:
parent
cf74b2be53
commit
20123b25ee
@ -576,7 +576,7 @@ ckfini(int markclean)
|
||||
rerun = 1;
|
||||
}
|
||||
}
|
||||
if (debug && totalreads > 0)
|
||||
if (debug && cachelookups > 0)
|
||||
printf("cache with %d buffers missed %d of %d (%d%%)\n",
|
||||
numbufs, cachereads, cachelookups,
|
||||
(int)(cachereads * 100 / cachelookups));
|
||||
|
Loading…
Reference in New Issue
Block a user