From 2e3d7bb735c48ec3c4f3d9db276e41f6b9a7a5cb Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Fri, 25 Mar 2022 12:07:22 +0100 Subject: [PATCH] main: Check g_setenv() return value From Coverity: iio-sensor-proxy-3.3/src/iio-sensor-proxy.c:964: check_return: Calling "g_setenv("G_MESSAGES_DEBUG", "all", 1)" without checking return value. This library function may fail and return an error code. --- src/iio-sensor-proxy.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/iio-sensor-proxy.c b/src/iio-sensor-proxy.c index e4bcee8..ef7b1e3 100644 --- a/src/iio-sensor-proxy.c +++ b/src/iio-sensor-proxy.c @@ -1001,7 +1001,10 @@ int main (int argc, char **argv) } if (verbose) { - g_setenv ("G_MESSAGES_DEBUG", "all", TRUE); + if (!g_setenv ("G_MESSAGES_DEBUG", "all", TRUE)) { + g_warning ("Failed to enable debug"); + return EXIT_FAILURE; + } g_debug ("Starting iio-sensor-proxy version "VERSION); }