commit db4a0581a15ff4e9489bdf81eb6caed1aa565433
parent 9cff63752cf8763bf649dac9d64810df68b83f66
Author: parazyd <parazyd@dyne.org>
Date: Wed, 31 Mar 2021 11:31:20 +0200
Change authorized if logic to make the code cleaner.
Diffstat:
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/git-restrict.c b/git-restrict.c
@@ -69,12 +69,11 @@ int main(int argc, char *argv[])
free(buf);
}
- if (authorized)
- if (execlp("git-shell", "git-shell", "-c", orig_cmd, (char *)NULL) < 0) {
- perror("execlp");
- return 1;
- }
+ if (!authorized)
+ die("fatal: Access to repository denied.");
+
+ if (execlp("git-shell", "git-shell", "-c", orig_cmd, (char *)NULL) < 0)
+ perror("execlp");
- die("fatal: Access to repository denied.");
return 1;
}