sbm

simple bandwidth monitor
git clone git://git.2f30.org/sbm.git
Log | Files | Refs | LICENSE

commit 54766cbfb7e6c0a099063710309225de4bc8f503
parent 467410cf5970dd0b6e8c7b7c5301ea405cdc0e5f
Author: sin <sin@2f30.org>
Date:   Mon Feb 22 14:27:41 +0000

Handle error early in clock_gettime_tv()

Makes it a bit more reusable.  Caller should never inspect tv
if the call failed so it doesn't provide additional safety.

Diffstat:
sbm.c | 2++
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/sbm.c b/sbm.c @@ -192,6 +192,8 @@ clock_gettime_tv(clockid_t clock_id, struct timeval *tv) int ret; ret = clock_gettime(clock_id, &ts); + if (ret < 0) + return -1; tv->tv_sec = ts.tv_sec; tv->tv_usec = ts.tv_nsec / 1000; return ret;