"name" will be reset unconditionally soon after skip_prefix() returns NULL. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> --- connect.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/connect.c b/connect.c index c763eed..1bb70aa 100644 --- a/connect.c +++ b/connect.c @@ -131,7 +131,7 @@ struct ref **get_remote_heads(int in, char *src_buf, size_t src_len, for (;;) { struct ref *ref; unsigned char old_sha1[20]; - char *name; + const char *name; int len, name_len; char *buffer = packet_buffer; @@ -145,8 +145,8 @@ struct ref **get_remote_heads(int in, char *src_buf, size_t src_len, if (!len) break; - if (len > 4 && starts_with(buffer, "ERR ")) - die("remote error: %s", buffer + 4); + if ((name = skip_prefix(buffer, "ERR ")) != NULL) + die("remote error: %s", name); if (len < 42 || get_sha1_hex(buffer, old_sha1) || buffer[40] != ' ') die("protocol error: expected sha/ref, got '%s'", buffer); -- 1.8.5.1.208.g019362e -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html