mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 00:37:00 +08:00
occtl: avoid division by zero
Resolves: #278 Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
This commit is contained in:
@@ -71,9 +71,12 @@ error:
|
||||
static void
|
||||
value2speed(unsigned long bytes, time_t time, char* output, unsigned output_size)
|
||||
{
|
||||
unsigned long speed;
|
||||
unsigned long speed;
|
||||
|
||||
speed = bytes / time;
|
||||
if (time == 0)
|
||||
speed = 0;
|
||||
else
|
||||
speed = bytes / time;
|
||||
bytes2human(speed, output, output_size, "/sec");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user