Commit 90463ec2 authored by Peter Hutterer's avatar Peter Hutterer

property: return EXIT_FAILURE if at least one device fails (#90226)

list-props allows for multiple devices to be queried simultaneously, so we
don't break out of the loop but rather change the exit code if at least one of
the devices doesn't exist.

X.Org Bug 90226 <http://bugs.freedesktop.org/show_bug.cgi?id=90226>
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent 4ed64e29
......@@ -169,6 +169,7 @@ list_props_xi1(Display *dpy, int argc, char** argv, char* name, char *desc)
int i;
int nprops;
Atom *props;
int rc = EXIT_SUCCESS;
if (argc == 0)
{
......@@ -182,6 +183,7 @@ list_props_xi1(Display *dpy, int argc, char** argv, char* name, char *desc)
if (!info)
{
fprintf(stderr, "unable to find device '%s'\n", argv[i]);
rc = EXIT_FAILURE;
continue;
}
......@@ -189,6 +191,7 @@ list_props_xi1(Display *dpy, int argc, char** argv, char* name, char *desc)
if (!dev)
{
fprintf(stderr, "unable to open device '%s'\n", info->name);
rc = EXIT_FAILURE;
continue;
}
......@@ -208,7 +211,7 @@ list_props_xi1(Display *dpy, int argc, char** argv, char* name, char *desc)
XFree(props);
XCloseDevice(dpy, dev);
}
return EXIT_SUCCESS;
return rc;
}
......@@ -532,6 +535,7 @@ list_props_xi2(Display *dpy, int argc, char** argv, char* name, char *desc)
int i;
int nprops;
Atom *props;
int rc = EXIT_SUCCESS;
if (argc == 0)
{
......@@ -545,6 +549,7 @@ list_props_xi2(Display *dpy, int argc, char** argv, char* name, char *desc)
if (!info)
{
fprintf(stderr, "unable to find device %s\n", argv[i]);
rc = EXIT_FAILURE;
continue;
}
......@@ -563,7 +568,7 @@ list_props_xi2(Display *dpy, int argc, char** argv, char* name, char *desc)
XFree(props);
}
return EXIT_SUCCESS;
return rc;
}
static int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment