diff options
| author | Vicent Martà <tanoku@gmail.com> | 2012-03-07 01:37:09 +0100 |
|---|---|---|
| committer | Vicent Martà <tanoku@gmail.com> | 2012-03-07 01:37:09 +0100 |
| commit | e54d8d8972ddfa886bfcf1a078d253b632debc72 (patch) | |
| tree | 545ea8da9594a61cdb599ddc5d330afe28ab415f /src/fileops.c | |
| parent | cb8a79617b15e347f26d21cedde0f2b8670c1876 (diff) | |
| download | libgit2-e54d8d8972ddfa886bfcf1a078d253b632debc72.tar.gz | |
error-handling: Config
Diffstat (limited to 'src/fileops.c')
| -rw-r--r-- | src/fileops.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/fileops.c b/src/fileops.c index 4414c86c6..c6a3be73d 100644 --- a/src/fileops.c +++ b/src/fileops.c @@ -295,7 +295,6 @@ int git_futils_rmdir_r(const char *path, int force) int git_futils_find_global_file(git_buf *path, const char *filename) { - int error; const char *home = getenv("HOME"); #ifdef GIT_WIN32 @@ -303,19 +302,21 @@ int git_futils_find_global_file(git_buf *path, const char *filename) home = getenv("USERPROFILE"); #endif - if (home == NULL) - return git__throw(GIT_EOSERR, "Failed to open global %s file. " - "Cannot locate the user's home directory.", filename); + if (home == NULL) { + giterr_set(GITERR_OS, "Global file lookup failed. " + "Cannot locate the user's home directory"); + return -1; + } - if ((error = git_buf_joinpath(path, home, filename)) < GIT_SUCCESS) - return error; + if (git_buf_joinpath(path, home, filename) < 0) + return -1; if (git_path_exists(path->ptr) == false) { git_buf_clear(path); return GIT_ENOTFOUND; } - return GIT_SUCCESS; + return 0; } #ifdef GIT_WIN32 |
