mirror of
https://github.com/xemu-project/xemu.git
synced 2025-02-09 21:53:16 +00:00
ui/sdl2: Check return value from g_setenv()
Setting environment variables can fail; check the return value from g_setenv() and bail out if we couldn't set SDL_VIDEODRIVER. Fixes: Coverity 1458798 Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20210809161424.32355-1-peter.maydell@linaro.org> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
da77adbaf6
commit
6ff5b5d6d5
@ -817,7 +817,10 @@ static void sdl2_display_init(DisplayState *ds, DisplayOptions *o)
|
|||||||
* This is a bit hackish but saves us from bigger problem.
|
* This is a bit hackish but saves us from bigger problem.
|
||||||
* Maybe it's a good idea to fix this in SDL instead.
|
* Maybe it's a good idea to fix this in SDL instead.
|
||||||
*/
|
*/
|
||||||
g_setenv("SDL_VIDEODRIVER", "x11", 0);
|
if (!g_setenv("SDL_VIDEODRIVER", "x11", 0)) {
|
||||||
|
fprintf(stderr, "Could not set SDL_VIDEODRIVER environment variable\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (SDL_Init(SDL_INIT_VIDEO)) {
|
if (SDL_Init(SDL_INIT_VIDEO)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user