[PATCH 2/2] submodule--helper, module_clone: catch fprintf failure
- From
Stefan Beller <sbeller@google.com>
- Date
- Apr 1, 2016, 00:17 UTC
- Message-ID
- <1459469849-9643-3-git-send-email-sbeller@google.com>
- In-Reply-To
- <1459469849-9643-1-git-send-email-sbeller@google.com>
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> --- builtin/submodule--helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index b099817..be7bf5f 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -230,8 +230,8 @@ static int module_clone(int argc, const char **argv, const char *prefix) if (!submodule_dot_git) die_errno(_("cannot open file '%s'"), sb.buf); - fprintf(submodule_dot_git, "gitdir: %s\n", - relative_path(sm_gitdir, path, &rel_path)); + fprintf_or_die(submodule_dot_git, "gitdir: %s\n", + relative_path(sm_gitdir, path, &rel_path)); if (fclose(submodule_dot_git)) die(_("could not close file %s"), sb.buf); strbuf_reset(&sb);
-- 2.5.0.264.gc776916.dirty