verify_signed_buffer: prefer close_tempfile() to close()
We do a manual close() on the descriptor provided to us by mks_tempfile. But this runs contrary to the advice in tempfile.h, which notes that you should always use close_tempfile(). Otherwise the descriptor may be reused without the tempfile object knowing it, and the later call to delete_tempfile() could close a random descriptor. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
c0e963b77c
commit
d88ef66051
@ -215,7 +215,7 @@ int verify_signed_buffer(const char *payload, size_t payload_size,
|
||||
delete_tempfile(&temp);
|
||||
return -1;
|
||||
}
|
||||
close(fd);
|
||||
close_tempfile(&temp);
|
||||
|
||||
argv_array_pushl(&gpg.args,
|
||||
gpg_program,
|
||||
|
Loading…
Reference in New Issue
Block a user