commit a78fc61aec254184b7e3055de6f9247ec06308ae
parent b8b35e2e1023c9ffe12b0b2101d79e4ea5b190e8
Author: Mohamed Aslan <maslan@sce.carleton.ca>
Date: Fri, 27 Jun 2014 15:50:23 -0400
fix a possible bug when generating commit message file
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cmd-commit.c b/cmd-commit.c
@@ -62,7 +62,7 @@ gen_temp_msgfile(const char *path, char **filename)
asprintf(&msg_file, "%s/tmp.XXXXXX", path);
if ((msgfd = mkstemp(msg_file)) == -1)
return EXIT_FAILURE;
- if (write(msgfd, msg_head, sizeof(msg_head) - 1) == -1)
+ if (write(msgfd, msg_head, sizeof(msg_head)) == -1)
return EXIT_FAILURE;
close(msgfd);
*filename = msg_file;
@@ -106,7 +106,7 @@ failure:
int
cmd_commit(int argc, char **argv)
{
- char *commit_msg = NULL, *msg_file;
+ char *commit_msg = NULL, *msg_file = NULL;
char *exec;
char *branch_head, *workdir_head;
const char *editor;