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.
This commit is contained in:
Bastien Nocera
2022-03-25 12:07:22 +01:00
parent a279a80502
commit 2e3d7bb735

View File

@@ -1001,7 +1001,10 @@ int main (int argc, char **argv)
} }
if (verbose) { 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); g_debug ("Starting iio-sensor-proxy version "VERSION);
} }