aboutsummaryrefslogtreecommitdiff
path: root/builtin-tag.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2007-09-17 20:06:46 -0400
committerJunio C Hamano <gitster@pobox.com>2007-09-27 00:33:29 -0700
commita9390b9fcefb18c4ccdb521086a051bc9112e03d (patch)
treef34be08d5e61f04d3d8cf876628dcf08597097c5 /builtin-tag.c
parentb4833a2c62578bdbfd300e296702214cb1b9a601 (diff)
downloadgit-a9390b9fcefb18c4ccdb521086a051bc9112e03d.tar.gz
git-a9390b9fcefb18c4ccdb521086a051bc9112e03d.tar.xz
Add strbuf_read_file().
Signed-off-by: Kristian Høgsberg <krh@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-tag.c')
-rw-r--r--builtin-tag.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/builtin-tag.c b/builtin-tag.c
index 82ebda11b..fcbf9bbf1 100644
--- a/builtin-tag.c
+++ b/builtin-tag.c
@@ -22,7 +22,6 @@ static void launch_editor(const char *path, struct strbuf *buffer)
const char *editor, *terminal;
struct child_process child;
const char *args[3];
- int fd;
editor = getenv("GIT_EDITOR");
if (!editor && editor_program)
@@ -52,13 +51,9 @@ static void launch_editor(const char *path, struct strbuf *buffer)
if (run_command(&child))
die("There was a problem with the editor %s.", editor);
- fd = open(path, O_RDONLY);
- if (fd < 0)
- die("could not open '%s': %s", path, strerror(errno));
- if (strbuf_read(buffer, fd, 0) < 0) {
- die("could not read message file '%s': %s", path, strerror(errno));
- }
- close(fd);
+ if (strbuf_read_file(buffer, path) < 0)
+ die("could not read message file '%s': %s",
+ path, strerror(errno));
}
struct tag_filter {