]> diplodocus.org Git - xorg-xinput/commitdiff
property: return EXIT_FAILURE if at least one device fails (#90226)
authorPeter Hutterer <peter.hutterer@who-t.net>
Wed, 29 Apr 2015 21:47:28 +0000 (07:47 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 29 Apr 2015 21:47:28 +0000 (07:47 +1000)
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>
src/property.c

index bf04eeb..0f073df 100644 (file)
@@ -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