From: Mathieu Desnoyers Date: Fri, 12 Feb 2016 20:44:10 +0000 (-0500) Subject: Fix: handle negative range for LTTNG_UST_REGISTER_TIMEOUT X-Git-Tag: v2.7.2~2 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=13b09b636068bd4395b7cdd4f0be99cbfa95fe2f;p=lttng-ust.git Fix: handle negative range for LTTNG_UST_REGISTER_TIMEOUT We should not consider values below -1 as valid timeout values, this is is unexpected and could lead to EINVAL errors returned by sem_timedwait. Signed-off-by: Mathieu Desnoyers --- diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c index 8effa369..f08e7b06 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -437,6 +437,9 @@ long get_timeout(void) } if (str_timeout) constructor_delay_ms = strtol(str_timeout, NULL, 10); + /* All negative values are considered as "-1". */ + if (constructor_delay_ms < -1) + constructor_delay_ms = -1; return constructor_delay_ms; }