submodule--helper, module_clone: catch fprintf failure

The return value of fprintf is unchecked, which may lead to unreported errors. Use fprintf_or_die to report the error to the user. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stefan Beller committed Mar 31, 2016 at 17:17 UTC 1f15ba1f3c370acbe85d451fe1520bffe0b2cb6f
1 file changed +2 -2
builtin/submodule--helper.c
+2 -2
@@ -229,8 +229,8 @@ static int module_clone(int argc, const char **argv, const char *prefix)
229 if (!submodule_dot_git)
230 die_errno(_("cannot open file '%s'"), sb.buf);
231
232 - fprintf(submodule_dot_git, "gitdir: %s\n",
233 - relative_path(sm_gitdir, path, &rel_path));
232 + fprintf_or_die(submodule_dot_git, "gitdir: %s\n",
233 + relative_path(sm_gitdir, path, &rel_path));
234 if (fclose(submodule_dot_git))
235 die(_("could not close file %s"), sb.buf);
236 strbuf_reset(&sb);