summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2015-04-30 07:47:28 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2015-04-30 07:47:28 +1000
commit90463ec26d4c89bdf63aab4ddac9f8295b6589cc (patch)
tree271df9ed2d96ff9671cbc8f4ddb1fdaefa3258f3
parent4ed64e29a0c4c728f3eff64725c0ed386d172ae4 (diff)
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 <peter.hutterer@who-t.net>
-rw-r--r--src/property.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/property.c b/src/property.c
index bf04eeb..0f073df 100644
--- a/src/property.c
+++ b/src/property.c
@@ -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