dmx: example code should set a good example
Resolves warning from Oracle Parfait static analyser: Error: Unchecked result Unchecked result [unchecked-result-call-X]: Unchecked return value from call to XOpenDisplay. Value display must be ch ecked to ensure this function was successful. at line 73 of hw/dmx/examples/xbell.c in function 'main'. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
parent
d00594ebc7
commit
034e792662
|
@ -70,7 +70,7 @@ pks(XKeyboardState * ks)
|
|||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
Display *display = XOpenDisplay(NULL);
|
||||
Display *display;
|
||||
XKeyboardControl kc;
|
||||
XKeyboardState ks;
|
||||
unsigned long vm;
|
||||
|
@ -86,6 +86,13 @@ main(int argc, char **argv)
|
|||
kc.bell_pitch = atoi(argv[3]);
|
||||
kc.bell_duration = atoi(argv[4]);
|
||||
|
||||
display = XOpenDisplay(NULL);
|
||||
if (display == NULL) {
|
||||
fprintf (stderr, "%s: unable to open display \"%s\".\n",
|
||||
argv[0], XDisplayName (NULL));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
printf("Setting:\n");
|
||||
pkc(&kc, vm);
|
||||
XChangeKeyboardControl(display, vm, &kc);
|
||||
|
|
Loading…
Reference in New Issue