tChange authorized if logic to make the code cleaner. - git-restrict - simple utility for git repo permission management
HTML git clone https://git.parazyd.org/git-restrict
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit db4a0581a15ff4e9489bdf81eb6caed1aa565433
DIR parent 9cff63752cf8763bf649dac9d64810df68b83f66
HTML Author: parazyd <parazyd@dyne.org>
Date: Wed, 31 Mar 2021 11:31:20 +0200
Change authorized if logic to make the code cleaner.
Diffstat:
M git-restrict.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
---
DIR diff --git a/git-restrict.c b/git-restrict.c
t@@ -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;
}