summaryrefslogtreecommitdiff
path: root/src/filebuf.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2011-03-05 14:34:32 +0200
committerVicent Marti <tanoku@gmail.com>2011-03-05 14:34:32 +0200
commit55ffebe37768b2b839f5501f76e77e89d9f91882 (patch)
treec9275716290855fd909df22c4163bf7797da02b8 /src/filebuf.c
parent246eba80af31d25a1fb14e707f79374cf91f8bb7 (diff)
downloadlibgit2-55ffebe37768b2b839f5501f76e77e89d9f91882.tar.gz
Fix creation of deeply-rooted references
Use a new `gitfo_creat_force` that will create the full path to a file before creating it. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'src/filebuf.c')
-rw-r--r--src/filebuf.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/filebuf.c b/src/filebuf.c
index 73f0a70f4..4fc4f1486 100644
--- a/src/filebuf.c
+++ b/src/filebuf.c
@@ -39,7 +39,12 @@ static int lock_file(git_filebuf *file, int flags)
return GIT_EOSERR;
}
- file->fd = gitfo_creat(file->path_lock, 0644);
+ /* create path to the file buffer is required */
+ if (flags & GIT_FILEBUF_FORCE) {
+ file->fd = gitfo_creat_force(file->path_lock, 0644);
+ } else {
+ file->fd = gitfo_creat(file->path_lock, 0644);
+ }
if (file->fd < 0)
return GIT_EOSERR;