commit 4a1545ecfba335e9eecb33dfac5cdae949090a88
parent ba0936bd825bf583f4521d4fb09aec4a38f24167
Author: parazyd <parazyd@dyne.org>
Date: Mon, 19 Apr 2021 02:00:45 +0200
Check for -1 rather than <0 on execlp.
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/git-restrict.c b/git-restrict.c
@@ -53,6 +53,7 @@ int main(int argc, char *argv[])
repo[strlen(repo) - 1] = 0;
for (i = 1; i < argc; i++) {
+ /* This is so both "foo" and "foo.git" are supported */
if ((buf = malloc(strlen(repo) + 4)) == NULL) {
perror("malloc");
return 1;
@@ -72,7 +73,7 @@ int main(int argc, char *argv[])
if (!authorized)
die("fatal: Access to repository denied.");
- if (execlp("git-shell", "git-shell", "-c", orig_cmd, (char *)NULL) < 0)
+ if (execlp("git-shell", "git-shell", "-c", orig_cmd, (char *)NULL) == -1)
perror("execlp");
return 1;