From: Peter Hutterer Date: Wed, 29 Apr 2015 21:47:28 +0000 (+1000) Subject: property: return EXIT_FAILURE if at least one device fails (#90226) X-Git-Url: https://diplodocus.org/git/xorg-xinput/commitdiff_plain/90463ec26d4c89bdf63aab4ddac9f8295b6589cc 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 Signed-off-by: Peter Hutterer --- 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