diff options
Diffstat (limited to 'src/fileops.c')
| -rw-r--r-- | src/fileops.c | 10 |
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; |
