diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2018-12-19 15:42:18 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2018-12-19 18:27:57 -0500 |
commit | e45b8acdc11c95e34c10d3c145120ab5c3e3ccec (patch) | |
tree | f8caa3d08b9dbba360d611e736edc6eccb85c708 | |
parent | 0e9822571cc8e27852dcf2b0008b50acd1263a81 (diff) |
Fix a divide by zero
-rw-r--r-- | libbcachefs.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libbcachefs.c b/libbcachefs.c index ea52ce48..f84a34ca 100644 --- a/libbcachefs.c +++ b/libbcachefs.c @@ -927,7 +927,9 @@ int bchu_data(struct bchfs_handle fs, struct bch_ioctl_data cmd) printf("\33[2K\r"); printf("%llu%% complete: current position %s", - e.p.sectors_done * 100 / e.p.sectors_total, + e.p.sectors_total + ? e.p.sectors_done * 100 / e.p.sectors_total + : 0, bch2_data_types[e.p.data_type]); switch (e.p.data_type) { |