pkexec: fix uninitialized pointer warning
Summary
The following warning occurs during the build* process:
[71/82] Compiling C object src/programs/pkexec.p/pkexec.c.o
../src/programs/pkexec.c: In function ‘main’:
../src/programs/pkexec.c:805:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
805 | gchar *cmdline_short = NULL;
| ^~~~~
../src/programs/pkexec.c:1074:3: warning: ‘cmdline_short’ may be used uninitialized [-Wmaybe-uninitialized]
1074 | g_free (cmdline_short);
| ^~~~~~~~~~~~~~~~~~~~~~
../src/programs/pkexec.c:805:10: note: ‘cmdline_short’ was declared here
805 | gchar *cmdline_short = NULL;
| ^~~~~~~~~~~~~
This commit changes the local variable cmdline_short
to a global variable and fixes the above warning.
* build process:
$ meson setup build; meson compile -C build
Fixes https://gitlab.freedesktop.org/polkit/polkit/-/issues/201 (uninitialized pointer warning)
Edited by Vincent Mihalkovic