From: Mikael Magnusson Date: Fri, 8 Jan 2010 20:51:35 +0000 (+0100) Subject: Pass NULL, not 0, handle invalid --id better. X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=4c544102c32a3b23bee23205fa0d4365ed02db09;p=chaz%2Fopenbox Pass NULL, not 0, handle invalid --id better. --- diff --git a/tools/obxprop/obxprop.c b/tools/obxprop/obxprop.c index b28b77a7..2e6b2a03 100644 --- a/tools/obxprop/obxprop.c +++ b/tools/obxprop/obxprop.c @@ -273,13 +273,13 @@ int main(int argc, char **argv) for (i = 1; i < argc; ++i) { if (!strcmp(argv[i], "--help")) { - return fail(0); + return fail(NULL); } else if (!strcmp(argv[i], "--root")) root = TRUE; else if (!strcmp(argv[i], "--id")) { if (++i == argc) - return fail(0); + return fail(NULL); if (argv[i][0] == '0' && argv[i][1] == 'x') { /* hex */ userid = parse_hex(argv[i]+2); @@ -288,11 +288,12 @@ int main(int argc, char **argv) /* decimal */ userid = atoi(argv[i]); } - break; + if (!userid) + return fail("Unable to parse argument to --id."); } else if (!strcmp(argv[i], "--display")) { if (++i == argc) - return fail(0); + return fail(NULL); dname = argv[i]; } else if (*argv[i] != '-')