summaryrefslogtreecommitdiff
path: root/src/path.c
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2012-05-07 13:58:01 +0200
committernulltoken <emeric.fermas@gmail.com>2012-05-08 10:05:18 +0200
commit9abb5bca5d094f832d2c68342aefc8809ec8ca09 (patch)
treec8efa3ba0f237ef631d402a740d1797a68fc1203 /src/path.c
parent46811561ae19701d4d0fc4b00113667f81961dfc (diff)
downloadlibgit2-9abb5bca5d094f832d2c68342aefc8809ec8ca09.tar.gz
compat: make p_realpath Windows implementation be a bit more POSIX compliant and fail if the provided path does not lead to an existing entry
Diffstat (limited to 'src/path.c')
-rw-r--r--src/path.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/path.c b/src/path.c
index ccf80edb4..9f31676b1 100644
--- a/src/path.c
+++ b/src/path.c
@@ -205,9 +205,13 @@ int git_path_prettify(git_buf *path_out, const char *path, const char *base)
}
if (p_realpath(path, buf) == NULL) {
+ /* giterr_set resets the errno when dealing with a GITERR_OS kind of error */
+ int error = (errno == ENOENT || errno == ENOTDIR) ? GIT_ENOTFOUND : -1;
giterr_set(GITERR_OS, "Failed to resolve path '%s'", path);
+
git_buf_clear(path_out);
- return (errno == ENOENT || errno == ENOTDIR) ? GIT_ENOTFOUND : -1;
+
+ return error;
}
return git_buf_sets(path_out, buf);