print errno when reporting a system call error
[gitweb.git] / commit.c
index fab8269731b4764351c7b68543337ded138d4aab..3eeda081f9bf9a765f41d44579cf5ee016bae129 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -167,7 +167,7 @@ struct commit_graft *read_graft_line(char *buf, int len)
 
 static int read_graft_file(const char *graft_file)
 {
-       FILE *fp = fopen(graft_file, "r");
+       FILE *fp = fopen_or_warn(graft_file, "r");
        struct strbuf buf = STRBUF_INIT;
        if (!fp)
                return -1;
@@ -415,8 +415,7 @@ int find_commit_subject(const char *commit_buffer, const char **subject)
                p++;
        if (*p) {
                p = skip_blank_lines(p + 2);
-               for (eol = p; *eol && *eol != '\n'; eol++)
-                       ; /* do nothing */
+               eol = strchrnul(p, '\n');
        } else
                eol = p;