summaryrefslogtreecommitdiff
path: root/src/fileops.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2010-12-13 03:43:56 +0200
committerVicent Marti <tanoku@gmail.com>2010-12-13 03:43:56 +0200
commit1f080e2da4833004fd178f622271879336085e22 (patch)
tree090d226c3d0da7473bc6d7ae687a1c58226b5d45 /src/fileops.c
parente0d9e12e502582d33f3e54bd77b274aaadbd60c6 (diff)
downloadlibgit2-1f080e2da4833004fd178f622271879336085e22.tar.gz
Fix initialization & freeing of inexistent repos
Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'src/fileops.c')
-rw-r--r--src/fileops.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/fileops.c b/src/fileops.c
index ea9935ab1..0633f9b21 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -74,8 +74,13 @@ int gitfo_isdir(const char *path)
stat_error = gitfo_stat(path, &st);
}
- return (stat_error == 0 && S_ISDIR(st.st_mode)) ?
- GIT_SUCCESS : GIT_ENOTFOUND;
+ if (stat_error < GIT_SUCCESS)
+ return GIT_ENOTFOUND;
+
+ if (!S_ISDIR(st.st_mode))
+ return GIT_ENOTFOUND;
+
+ return GIT_SUCCESS;
}
int gitfo_exists(const char *path)