diff options
author | Jim Meyering <meyering@redhat.com> | 2009-09-12 10:43:27 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-09-13 01:32:20 -0700 |
commit | 41698375ada57d51cf6db5cf25970ccd1b918180 (patch) | |
tree | a1ed2b0f32a829bdb0b4cece3d85df933b924962 /transport-helper.c | |
parent | 3d913526b19545eb4e463f96d2f3b8db8daae6ef (diff) | |
download | git-41698375ada57d51cf6db5cf25970ccd1b918180.tar.gz |
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.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/transport-helper.c b/transport-helper.c index 832d81f231..f57e84c676 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) |