[dm-devel] [PATCH] multipath-tools (coverity): assert availability of CLOCK_MONOTONIC

Bart Van Assche bvanassche at acm.org
Mon May 20 20:09:56 UTC 2019


On 5/20/19 6:30 PM, Martin Wilck wrote:
> +void get_monotonic_time(struct timespec *res)
> +{
> +	struct timespec ts;
> +
> +	assert(clock_gettime(CLOCK_MONOTONIC, &ts) == 0);
> +	*res = ts;
> +}

This is an example of bad coding style because the clock_gettime() call
will be skipped if anyone would compile this code with -DNDEBUG.

Bart.





More information about the dm-devel mailing list