From ebbf97d1d30077057f22a808dfc4d02ce07ff338 Mon Sep 17 00:00:00 2001 From: "R. Steve McKown" Date: Thu, 27 Sep 2012 22:41:36 -0600 Subject: [PATCH] Properly handle wrong arg count when -t --- repo_shell.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/repo_shell.c b/repo_shell.c index 4d9f79b..dc9b8d6 100644 --- a/repo_shell.c +++ b/repo_shell.c @@ -203,9 +203,12 @@ int main(int argc, char **argv) if (ini_parse(CFG_FILE, ini_handler, &cfg) < 0) die("cannot read config file %s", CFG_FILE); - if (argc == 4 && (!strcmp(argv[1], "-t") || - !strcmp(argv[1], "--test"))) { - perms_t p = git_acl(argv[2], argv[3], cfg.git_acl_file); + if ((!strcmp(argv[1], "-t") || !strcmp(argv[1], "--test"))) { + perms_t p; + + if (argc !=4) + die("usage: %s -t ", argv[0]); + p = git_acl(argv[2], argv[3], cfg.git_acl_file); fprintf(stderr, "user '%s' repo '%s' perms '%s'\n via userid '%s' repoid '%s'\n", argv[2], argv[3], git_acl_perms_as_str(p), git_acl_last_userid(), -- 2.39.2