diff options
author | Rene Scharfe <rene.scharfe@lsrfire.ath.cx> | 2006-08-21 20:43:43 +0200 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-08-21 20:22:23 -0700 |
commit | 7230e6d042ae385377f09c4d226d9b1aa7a2c13b (patch) | |
tree | 15c64d30f517ba50cac77f81efddc71d22666023 /cache.h | |
parent | Axe the last ent (diff) | |
download | tgif-7230e6d042ae385377f09c4d226d9b1aa7a2c13b.tar.xz |
Add write_or_die(), a helper function
The little helper write_or_die() won't come back with bad news about
full disks or broken pipes. It either succeeds or terminates the
program, making additional error handling unnecessary.
This patch adds the new function and uses it to replace two similar
ones (the one in tar-tree originally has been copied from cat-file
btw.). I chose to add the fd parameter which both lacked to make
write_or_die() just as flexible as write() and thus suitable for
lib-ification.
There is a regression: error messages emitted by this function don't
show the program name, while the replaced two functions did. That's
acceptable, I think; a lot of other functions do the same.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'cache.h')
-rw-r--r-- | cache.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -388,6 +388,7 @@ extern char git_default_name[MAX_GITNAME]; extern char git_commit_encoding[MAX_ENCODING_LENGTH]; extern int copy_fd(int ifd, int ofd); +extern void write_or_die(int fd, const void *buf, size_t count); /* Finish off pack transfer receiving end */ extern int receive_unpack_pack(int fd[2], const char *me, int quiet, int); |