Avoid division by zero if no connection was made.
authortb <tb@openbsd.org>
Wed, 31 Aug 2022 12:29:08 +0000 (12:29 +0000)
committertb <tb@openbsd.org>
Wed, 31 Aug 2022 12:29:08 +0000 (12:29 +0000)
CID 184043

usr.bin/openssl/s_time.c

index cdaac7e..92fdb59 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: s_time.c,v 1.34 2019/07/14 03:30:46 guenther Exp $ */
+/* $OpenBSD: s_time.c,v 1.35 2022/08/31 12:29:08 tb Exp $ */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -458,9 +458,7 @@ benchmark(int reuse_session)
        printf("\n\n%d connections in %.2fs; %.2f connections/user sec, bytes read %ld\n",
            nConn, totalTime, ((double) nConn / totalTime), bytes_read);
        printf("%d connections in %.0f real seconds, %ld bytes read per connection\n",
-           nConn,
-           elapsed,
-           bytes_read / nConn);
+           nConn, elapsed, nConn > 0 ? bytes_read / nConn : 0);
 
        ret = 0;
  end: