summaryrefslogtreecommitdiff
path: root/strbuf.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2015-07-13 14:00:27 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-07-13 14:00:27 -0700
commitd790ba92cc534127fc4c0d58a901d1553835aa62 (patch)
tree3facd1640b2c5f11994a00400c1a641c10753f0a /strbuf.c
parentMerge branch 'jc/unexport-git-pager-in-use-in-pager' (diff)
parentstrbuf: strbuf_read_file() should return ssize_t (diff)
downloadtgif-d790ba92cc534127fc4c0d58a901d1553835aa62.tar.xz
Merge branch 'mh/strbuf-read-file-returns-ssize-t'
Avoid possible ssize_t to int truncation. * mh/strbuf-read-file-returns-ssize-t: strbuf: strbuf_read_file() should return ssize_t
Diffstat (limited to 'strbuf.c')
-rw-r--r--strbuf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/strbuf.c b/strbuf.c
index 0d4f4e54ec..bbaf32eef6 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -526,9 +526,10 @@ int strbuf_getwholeline_fd(struct strbuf *sb, int fd, int term)
return 0;
}
-int strbuf_read_file(struct strbuf *sb, const char *path, size_t hint)
+ssize_t strbuf_read_file(struct strbuf *sb, const char *path, size_t hint)
{
- int fd, len;
+ int fd;
+ ssize_t len;
fd = open(path, O_RDONLY);
if (fd < 0)