summaryrefslogtreecommitdiff
path: root/write_or_die.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2016-08-03 23:01:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-08-05 16:28:17 (GMT)
commitca5c701ca50c24807793294c5ed22230858ac5e6 (patch)
tree24b40f5c032c973de2ee4572a535048de870a041 /write_or_die.c
parent46ac74b71681f1d2ff29615236193e651dcdd9fe (diff)
downloadgit-ca5c701ca50c24807793294c5ed22230858ac5e6.zip
git-ca5c701ca50c24807793294c5ed22230858ac5e6.tar.gz
git-ca5c701ca50c24807793294c5ed22230858ac5e6.tar.bz2
write_or_die: drop write_or_whine_pipe()
This function has no callers, and is not likely to gain any because it's confusing to use. It unconditionally complains to stderr, but _doesn't_ die. Yet any caller which wants a "gentle" write would generally want to suppress the error message, because presumably they're going to write a better one, and/or try the operation again. And the check_pipe() call leads to confusing behaviors. It means we die for EPIPE, but not for other errors, which is confusing and pointless. On top of all that, it has unusual error return semantics, which makes it easy for callers to get it wrong. Let's drop the function, and if somebody ever needs to resurrect something like it, they can fix these warts. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'write_or_die.c')
-rw-r--r--write_or_die.c12
1 files changed, 0 insertions, 12 deletions
diff --git a/write_or_die.c b/write_or_die.c
index 9816879..0734432 100644
--- a/write_or_die.c
+++ b/write_or_die.c
@@ -82,15 +82,3 @@ void write_or_die(int fd, const void *buf, size_t count)
die_errno("write error");
}
}
-
-int write_or_whine_pipe(int fd, const void *buf, size_t count, const char *msg)
-{
- if (write_in_full(fd, buf, count) < 0) {
- check_pipe(errno);
- fprintf(stderr, "%s: write error (%s)\n",
- msg, strerror(errno));
- return 0;
- }
-
- return 1;
-}