author | Linus Torvalds <torvalds@osdl.org> | |
Wed, 24 May 2006 15:30:54 +0000 (08:30 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 24 May 2006 20:36:13 +0000 (13:36 -0700) | ||
commit | 4d548150ace0816dd5fe678cdbde75b13d5e5249 | |
tree | 87a802994d97a27a7fee110613e4eaa004165eae | tree | snapshot |
parent | f81daefe56b3c97b93a851e1ada14eeca0dea47a | commit | diff |
Clean up sha1 file writing
This cleans up and future-proofs the sha1 file writing in sha1_file.c.
In particular, instead of doing a simple "write()" call and just verifying
that it succeeds (or - as in one place - just assuming it does), it uses
"write_buffer()" to write data to the file descriptor while correctly
checking for partial writes, EINTR etc.
It also splits up write_sha1_to_fd() to be a lot more readable: if we need
to re-create the compressed object, we do so in a separate helper
function, making the logic a whole lot more modular and obvious.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This cleans up and future-proofs the sha1 file writing in sha1_file.c.
In particular, instead of doing a simple "write()" call and just verifying
that it succeeds (or - as in one place - just assuming it does), it uses
"write_buffer()" to write data to the file descriptor while correctly
checking for partial writes, EINTR etc.
It also splits up write_sha1_to_fd() to be a lot more readable: if we need
to re-create the compressed object, we do so in a separate helper
function, making the logic a whole lot more modular and obvious.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
sha1_file.c | diff | blob | history |