summaryrefslogtreecommitdiff
path: root/builtin/am.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2017-04-16 16:55:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-04-18 00:37:28 (GMT)
commitfa1912c89a72fbd94591f4f5d522e5867ffe9bb6 (patch)
tree23ed30cd24661d62f4e5cb374f7f8166a059f413 /builtin/am.c
parentbe686f03e0f4c4f14f1d4ae9b1b35836168a0a4b (diff)
downloadgit-fa1912c89a72fbd94591f4f5d522e5867ffe9bb6.zip
git-fa1912c89a72fbd94591f4f5d522e5867ffe9bb6.tar.gz
git-fa1912c89a72fbd94591f4f5d522e5867ffe9bb6.tar.bz2
server-info: avoid calling fclose(3) twice in update_info_file()
If an error occurs when or after closing the stream we call fclose(3) again in the error handler. The second call can exhibit undefined behavior, so make sure to call fclose(3) at most once. Also avoid calling close(2) after fd has been successfully associated with the stream, as fclose(3) has become responsible for doing that beyond this point. Found with Cppcheck. Signed-off-by: Rene Scharfe <l.s.r@web.de> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/am.c')
0 files changed, 0 insertions, 0 deletions