Commit 1ebfdd669f520b95d7b084520c168fd68fb33135

Thomas de Grivel 2021-01-07T12:15:11

debug messages

diff --git a/git-auth.c b/git-auth.c
index c533541..ab1a5d6 100644
--- a/git-auth.c
+++ b/git-auth.c
@@ -95,7 +95,7 @@ static int rule_match (s_rule *rule, int argc, const char **argv)
           return 0;
   if (!strcmp(argv[1], "git-upload-pack") && !(rule->mode & 1))
           return 0;
-  if (!strcmp(argv[1], "git-receive-pack") && !(rule->mode & 2))
+  else if (!strcmp(argv[1], "git-receive-pack") && !(rule->mode & 2))
           return 0;
   if (strcmp(rule->path, argv[2]))
           return 0;
diff --git a/rule.c b/rule.c
index 5e905f9..c956e95 100644
--- a/rule.c
+++ b/rule.c
@@ -153,6 +153,8 @@ int read_rules (s_rule rules[RULES_MAX], const char *path)
                 if (!fgets(buf, BUFSZ, fp)) {
                         if (ferror(fp))
                                 err(1, "%s", path);
+                        bzero(&rules[r], sizeof(s_rule));
+                        fprintf(stderr, "fgets NULL. r: %d\n", r);
                         return r;
                 }
                 if (!(nl = strchr(buf, '\n'))) {
@@ -174,5 +176,6 @@ int read_rules (s_rule rules[RULES_MAX], const char *path)
         bzero(&rules[r], sizeof(s_rule));
         if (error)
                 exit(1);
+        fprintf(stderr, "EOF. r: %d\n", r);
         return r;
 }