From 4c544102c32a3b23bee23205fa0d4365ed02db09 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Fri, 8 Jan 2010 21:51:35 +0100 Subject: [PATCH] Pass NULL, not 0, handle invalid --id better. --- tools/obxprop/obxprop.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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] != '-')