mirror of
https://github.com/git/git.git
synced 2024-11-27 12:03:55 +08:00
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:
parent
7bb2bf8e5c
commit
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)
|
||||
|
Loading…
Reference in New Issue
Block a user