summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 898243b)
raw | patch | inline | side by side (parent: 898243b)
author | Jonathan Nieder <jrnieder@gmail.com> | |
Sun, 16 Jan 2011 03:49:40 +0000 (21:49 -0600) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 18 Jan 2011 18:18:25 +0000 (10:18 -0800) |
Instead of stripping space characters past the beginning of the
line and overflowing a buffer, stop at the beginning of the line
(mimicking the corresponding fix in remote-fd).
The argument to isspace does not need to be cast explicitly because
git isspace takes care of that already.
Noticed-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
line and overflowing a buffer, stop at the beginning of the line
(mimicking the corresponding fix in remote-fd).
The argument to isspace does not need to be cast explicitly because
git isspace takes care of that already.
Noticed-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/remote-ext.c | patch | blob | history |
diff --git a/builtin/remote-ext.c b/builtin/remote-ext.c
index 1f773171cbdde76cc105e37928cc5f2ecb2ed93f..ea71977c8360e1a7899bbd035cf26f93d889800b 100644 (file)
--- a/builtin/remote-ext.c
+++ b/builtin/remote-ext.c
char buffer[MAXCOMMAND];
while (1) {
- size_t length;
+ size_t i;
if (!fgets(buffer, MAXCOMMAND - 1, stdin)) {
if (ferror(stdin))
die("Comammand input error");
exit(0);
}
/* Strip end of line characters. */
- length = strlen(buffer);
- while (isspace((unsigned char)buffer[length - 1]))
- buffer[--length] = 0;
+ i = strlen(buffer);
+ while (i > 0 && isspace(buffer[i - 1]))
+ buffer[--i] = 0;
if (!strcmp(buffer, "capabilities")) {
printf("*connect\n\n");