Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2013-08-17 09:11:31 +0400
committerCarlos Martín Nieto <cmn@dwim.me>2013-10-11 18:29:59 +0400
commit7c9f5bec5182eb587fbc1094f2235d2babb70ad9 (patch)
tree59a8a653c0ae1943deb133c42a2fc730bc995bd6 /src/fileops.c
parent51a5e13347a0f834e2d847b46d2f6002f03bd49f (diff)
futils: return GIT_ENOTFOUND when trying to read a directory
This lets the reference code return not-found when the user asks to look up a reference when in fact they pass a namespace.
Diffstat (limited to 'src/fileops.c')
-rw-r--r--src/fileops.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/fileops.c b/src/fileops.c
index 3a5a53074..210f45fa1 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -165,7 +165,13 @@ int git_futils_readbuffer_updated(
return -1;
}
- if (S_ISDIR(st.st_mode) || !git__is_sizet(st.st_size+1)) {
+
+ if (S_ISDIR(st.st_mode)) {
+ giterr_set(GITERR_INVALID, "requested file is a directory");
+ return GIT_ENOTFOUND;
+ }
+
+ if (!git__is_sizet(st.st_size+1)) {
giterr_set(GITERR_OS, "Invalid regular file stat for '%s'", path);
return -1;
}