summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3d91352)
raw | patch | inline | side by side (parent: 3d91352)
author | Jim Meyering <meyering@redhat.com> | |
Sat, 12 Sep 2009 08:43:27 +0000 (10:43 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 13 Sep 2009 08:32:20 +0000 (01:32 -0700) |
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>
that checks and dies.
Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-add.c | patch | blob | history | |
builtin-mailsplit.c | patch | blob | history | |
bundle.c | patch | blob | history | |
transport-helper.c | patch | blob | history | |
upload-pack.c | patch | blob | history |
diff --git a/builtin-add.c b/builtin-add.c
index a5714735e6ef70f92f56a4cca67c7b78e3ef255a..cb6e5906fb76f2460f212c54b557e5ae0ce23579 100644 (file)
--- a/builtin-add.c
+++ b/builtin-add.c
out = open(file, O_CREAT | O_WRONLY, 0644);
if (out < 0)
die ("Could not open '%s' for writing.", file);
- rev.diffopt.file = fdopen(out, "w");
+ rev.diffopt.file = xfdopen(out, "w");
rev.diffopt.close_file = 1;
if (run_diff_files(&rev, 0))
die ("Could not write patch");
diff --git a/builtin-mailsplit.c b/builtin-mailsplit.c
index ee6ca0ebcd0a9ad63da79575f6bc26116b5606c2..dfe5b151e6e0030abf6248808d414b2fecc5fdb7 100644 (file)
--- a/builtin-mailsplit.c
+++ b/builtin-mailsplit.c
fd = open(name, O_WRONLY | O_CREAT | O_EXCL, 0666);
if (fd < 0)
die_errno("cannot open output file '%s'", name);
- output = fdopen(fd, "w");
+ output = xfdopen(fd, "w");
/* Copy it out, while searching for a line that begins with
* "From " and having something that looks like a date format.
diff --git a/bundle.c b/bundle.c
index e4b2aa9c4a2a7fb52121828343aa27ab47d17279..df95e151e2e82b48e4f15f2180838bf2d178f923 100644 (file)
--- a/bundle.c
+++ b/bundle.c
rls.git_cmd = 1;
if (start_command(&rls))
return -1;
- rls_fout = fdopen(rls.out, "r");
+ rls_fout = xfdopen(rls.out, "r");
while (fgets(buffer, sizeof(buffer), rls_fout)) {
unsigned char sha1[20];
if (buffer[0] == '-') {
diff --git a/transport-helper.c b/transport-helper.c
index 832d81f231d54e62a1dea5205585b0caa7954436..f57e84c67641b5a03ba8d9ed5182507bb54dcd15 100644 (file)
--- a/transport-helper.c
+++ b/transport-helper.c
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 */
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;
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)
diff --git a/upload-pack.c b/upload-pack.c
index b3471e417de64fb6bef300923f4b2c1b6351fa6d..38ddac2e8607f4cc6a801eeb49ba755dd89ee81c 100644 (file)
--- a/upload-pack.c
+++ b/upload-pack.c
int i;
struct rev_info revs;
- pack_pipe = fdopen(fd, "w");
+ pack_pipe = xfdopen(fd, "w");
init_revisions(&revs, NULL);
revs.tag_objects = 1;
revs.tree_objects = 1;
/* pass on revisions we (don't) want */
if (!shallow_nr) {
- FILE *pipe_fd = fdopen(pack_objects.in, "w");
+ FILE *pipe_fd = xfdopen(pack_objects.in, "w");
if (!create_full_pack) {
int i;
for (i = 0; i < want_obj.nr; i++)