aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
Diffstat (limited to 'builtin')
-rw-r--r--builtin/remote-ext.c8
-rw-r--r--builtin/remote-fd.c6
2 files changed, 6 insertions, 8 deletions
diff --git a/builtin/remote-ext.c b/builtin/remote-ext.c
index 1d3f1cf3c..1f773171c 100644
--- a/builtin/remote-ext.c
+++ b/builtin/remote-ext.c
@@ -142,7 +142,7 @@ static const char **parse_argv(const char *arg, const char *service)
for (i = 0; i < arguments; i++)
ret[i] = temparray[i];
ret[arguments] = NULL;
- return (const char **)ret;
+ return ret;
}
static void send_git_request(int stdin_fd, const char *serv, const char *repo,
@@ -239,10 +239,8 @@ static int command_loop(const char *child)
int cmd_remote_ext(int argc, const char **argv, const char *prefix)
{
- if (argc < 3) {
- fprintf(stderr, "Error: URL missing");
- exit(1);
- }
+ if (argc != 3)
+ die("Expected two arguments");
return command_loop(argv[2]);
}
diff --git a/builtin/remote-fd.c b/builtin/remote-fd.c
index 7517f2476..1f2467bdb 100644
--- a/builtin/remote-fd.c
+++ b/builtin/remote-fd.c
@@ -31,7 +31,7 @@ static void command_loop(int input_fd, int output_fd)
}
/* Strip end of line characters. */
i = strlen(buffer);
- while (isspace(buffer[i - 1]))
+ while (i > 0 && isspace(buffer[i - 1]))
buffer[--i] = 0;
if (!strcmp(buffer, "capabilities")) {
@@ -56,8 +56,8 @@ int cmd_remote_fd(int argc, const char **argv, const char *prefix)
int output_fd = -1;
char *end;
- if (argc < 3)
- die("URL missing");
+ if (argc != 3)
+ die("Expected two arguments");
input_fd = (int)strtoul(argv[2], &end, 10);