diff --git a/dist.c b/dist.c index 90928de..19f345d 100644 --- a/dist.c +++ b/dist.c @@ -39,7 +39,7 @@ int rtnl_netem_set_delay_distribution_data(struct rtnl_qdisc *qdisc, short *data struct rtnl_netem *netem; if (!(netem = rtnl_tc_data(TC_CAST(qdisc)))) - BUG(); + return -1; if (len > MAXDIST) return -NLE_INVAL; diff --git a/utils.c b/utils.c index 9860f93..42da96d 100644 --- a/utils.c +++ b/utils.c @@ -23,8 +23,9 @@ uint16_t chksum_rfc1071(char *buf, size_t count) /* This is the inner loop */ while (count > 1) { - sum += * (uint16_t) buf++; + sum += * (uint16_t *) buf; count -= 2; + buf += 2; } /* Add left-over byte, if any */ diff --git a/utils.h b/utils.h index f09a172..6bc05c2 100644 --- a/utils.h +++ b/utils.h @@ -9,6 +9,7 @@ #ifndef _UTILS_H_ #define _UTILS_H_ +#include #include #define MIN(x, y) ((x < y) ? x : y) @@ -22,7 +23,7 @@ void * alloc(size_t bytes); * * Source: RFC 1071 */ -uint16_t chksum_rfc1071(char *buf, size_t count) +uint16_t chksum_rfc1071(char *buf, size_t count); /** Safely append a format string to an existing string. *