baseline

yet another open-source distributed versioning control system
Log | Files | Refs

commit 5daa6f38528cbbb18440014965a5874ea979145f
parent 2d5a423ec4e92d499a1266b2c8980fb0bec3d96f
Author: Mohamed Aslan <maslan@sce.carleton.ca>
Date:   Fri, 27 Jun 2014 15:57:36 -0400

fix a bug when parsing commit message

Diffstat:
Mobjdb-fs.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/objdb-fs.c b/objdb-fs.c @@ -179,6 +179,7 @@ commit_deserialize(int fd, struct commit *comm) char buf[128], *p1, *p2; off_t end, pos; size_t len; + ssize_t n; /* 1. */ /* find the commit's dir */ @@ -287,10 +288,11 @@ commit_deserialize(int fd, struct commit *comm) /* for now the max. size of a message is 10 MBytes */ if (len < 1048576) { comm->message = (char *)malloc(len); - if ((read(fd, comm->message, len)) == -1) { + if ((n = read(fd, comm->message, len)) == -1) { fprintf(stderr, "error reading file.\n"); return EXIT_FAILURE; } + comm->message[n - 1] = '\0'; } else { goto bigmsg_error;