summaryrefslogtreecommitdiff
path: root/src/fileops.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2017-12-28 10:38:31 +0000
committerGitHub <noreply@github.com>2017-12-28 10:38:31 +0000
commit083b1a2e2d8d190db02db3db0dad4fa742eccb02 (patch)
tree9d1a4285c20999482501ba01be484ba8e402ab2e /src/fileops.c
parent4110fc8444080aa50449630b634d7337c30924b8 (diff)
parentc081f0d00dd2a2cd2aab7175cd2c65413f1cf52a (diff)
downloadlibgit2-083b1a2e2d8d190db02db3db0dad4fa742eccb02.tar.gz
Merge pull request #4021 from carlosmn/cmn/refspecs-fetchhead
FETCH_HEAD and multiple refspecs
Diffstat (limited to 'src/fileops.c')
-rw-r--r--src/fileops.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/fileops.c b/src/fileops.c
index ad3f67e2b..58988c2d2 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -102,6 +102,16 @@ int git_futils_open_ro(const char *path)
return fd;
}
+int git_futils_truncate(const char *path, int mode)
+{
+ int fd = p_open(path, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, mode);
+ if (fd < 0)
+ return git_path_set_error(errno, path, "open");
+
+ close(fd);
+ return 0;
+}
+
git_off_t git_futils_filesize(git_file fd)
{
struct stat sb;