summaryrefslogtreecommitdiff
path: root/transport-helper.c
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-09-12 08:43:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-09-13 08:32:20 (GMT)
commit41698375ada57d51cf6db5cf25970ccd1b918180 (patch)
treea1ed2b0f32a829bdb0b4cece3d85df933b924962 /transport-helper.c
parent3d913526b19545eb4e463f96d2f3b8db8daae6ef (diff)
downloadgit-41698375ada57d51cf6db5cf25970ccd1b918180.zip
git-41698375ada57d51cf6db5cf25970ccd1b918180.tar.gz
git-41698375ada57d51cf6db5cf25970ccd1b918180.tar.bz2
don't dereference NULL upon fdopen failure
There were several unchecked use of fdopen(); replace them with xfdopen() that checks and dies. Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport-helper.c')
-rw-r--r--transport-helper.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/transport-helper.c b/transport-helper.c
index 832d81f..f57e84c 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -39,7 +39,7 @@ static struct child_process *get_helper(struct transport *transport)
write_str_in_full(helper->in, "capabilities\n");
- file = fdopen(helper->out, "r");
+ file = xfdopen(helper->out, "r");
while (1) {
if (strbuf_getline(&buf, file, '\n') == EOF)
exit(128); /* child died, message supplied already */
@@ -71,7 +71,7 @@ static int fetch_with_fetch(struct transport *transport,
int nr_heads, const struct ref **to_fetch)
{
struct child_process *helper = get_helper(transport);
- FILE *file = fdopen(helper->out, "r");
+ FILE *file = xfdopen(helper->out, "r");
int i;
struct strbuf buf = STRBUF_INIT;
@@ -124,7 +124,7 @@ static struct ref *get_refs_list(struct transport *transport, int for_push)
write_str_in_full(helper->in, "list\n");
- file = fdopen(helper->out, "r");
+ file = xfdopen(helper->out, "r");
while (1) {
char *eov, *eon;
if (strbuf_getline(&buf, file, '\n') == EOF)