зеркало из https://github.com/microsoft/git.git
resolve_ref(): use prefixcmp()
Terminate the link content string one step earlier, allowing prefixcmp() to be used instead of the less clear memcmp(). Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
7bb2bf8e5c
Коммит
b54cb79597
4
refs.c
4
refs.c
|
@ -520,8 +520,8 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *
|
|||
len = readlink(path, buffer, sizeof(buffer)-1);
|
||||
if (len < 0)
|
||||
return NULL;
|
||||
if (len >= 5 && !memcmp("refs/", buffer, 5)) {
|
||||
buffer[len] = 0;
|
||||
buffer[len] = 0;
|
||||
if (!prefixcmp(buffer, "refs/")) {
|
||||
strcpy(ref_buffer, buffer);
|
||||
ref = ref_buffer;
|
||||
if (flag)
|
||||
|
|
Загрузка…
Ссылка в новой задаче