]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdmaptool: fix divide by zero error 12561/head
authorYunchuan Wen <yunchuan.wen@kylin-cloud.com>
Mon, 19 Dec 2016 04:48:14 +0000 (12:48 +0800)
committerYunchuan Wen <yunchuan.wen@kylin-cloud.com>
Mon, 19 Dec 2016 04:56:37 +0000 (12:56 +0800)
Signed-off-by: Yunchuan Wen <yunchuan.wen@kylin-cloud.com>
src/tools/osdmaptool.cc

index b679ad9621b4133e9289f61cdd4d99c726ff4f4b..5ed2b948a85160586f46344c28fcb0d0acc12e74 100644 (file)
@@ -407,7 +407,7 @@ int main(int argc, const char **argv)
        max_osd = i;
 
     }
-    uint64_t avg = total / in;
+    uint64_t avg = in ? (total / in) : 0;
     double dev = 0;
     for (int i=0; i<n; i++) {
       if (!osdmap.is_in(i))