Unverified Commit ae49d554 by Edward Thomson Committed by GitHub

Merge pull request #6547 from libgit2/ethomson/programdata

config: return `GIT_ENOTFOUND` for missing programdata
parents 51f3e0a4 54bcafeb
...@@ -1174,9 +1174,12 @@ int git_config__find_programdata(git_str *path) ...@@ -1174,9 +1174,12 @@ int git_config__find_programdata(git_str *path)
GIT_FS_PATH_OWNER_CURRENT_USER | GIT_FS_PATH_OWNER_CURRENT_USER |
GIT_FS_PATH_OWNER_ADMINISTRATOR; GIT_FS_PATH_OWNER_ADMINISTRATOR;
bool is_safe; bool is_safe;
int error;
if ((error = git_sysdir_find_programdata_file(path, GIT_CONFIG_FILENAME_PROGRAMDATA)) < 0)
return error;
if (git_sysdir_find_programdata_file(path, GIT_CONFIG_FILENAME_PROGRAMDATA) < 0 || if (git_fs_path_owner_is(&is_safe, path->ptr, owner_level) < 0)
git_fs_path_owner_is(&is_safe, path->ptr, owner_level) < 0)
return -1; return -1;
if (!is_safe) { if (!is_safe) {
......
#include "clar_libgit2.h"
void test_config_find__one(void)
{
git_buf buf = GIT_BUF_INIT;
cl_git_fail_with(GIT_ENOTFOUND, git_config_find_global(&buf));
cl_git_fail_with(GIT_ENOTFOUND, git_config_find_xdg(&buf));
cl_git_fail_with(GIT_ENOTFOUND, git_config_find_system(&buf));
cl_git_fail_with(GIT_ENOTFOUND, git_config_find_programdata(&buf));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment