summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRomain Geissler <romain.geissler@gmail.com>2011-06-05 00:17:26 +0200
committerRomain Geissler <romain.geissler@gmail.com>2011-06-05 00:17:26 +0200
commit8b05e780180072d1fab525ec29100d63beb104a6 (patch)
tree7e852dbd006ce98ca8a37a5c246216579ba7f4b2 /src
parent9d9bab5c384fd5d2f2832f6a68b36ce6848e0552 (diff)
downloadlibgit2-8b05e780180072d1fab525ec29100d63beb104a6.tar.gz
Repository: Fixed a bug in read_gitfile (proprely remove trailings newlines)
Diffstat (limited to 'src')
-rw-r--r--src/repository.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/repository.c b/src/repository.c
index cae43dc3b..91f27d406 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -409,8 +409,8 @@ static int read_gitfile(char *path_out, size_t size, const char *file_path, cons
end_offset = strlen(data) - 1;
- for (;data[end_offset] != '\r' && data[end_offset] != '\n'; --end_offset);
- data[end_offset] = '\0';
+ for (;data[end_offset] == '\r' || data[end_offset] == '\n'; --end_offset);
+ data[end_offset + 1] = '\0';
if (GIT_FILE_CONTENT_PREFIX_LENGTH == end_offset) {
gitfo_free_buf(&file);