mirror of
https://github.com/valitydev/osquery-1.git
synced 2024-11-07 18:08:53 +00:00
Merge pull request #949 from jedi22/file_changes_paths_single_file_fix
[Fix #948] Absolute paths in wildcard resolution
This commit is contained in:
commit
1455b66dd0
@ -281,7 +281,8 @@ Status resolveLastPathComponent(const fs::path& fs_path,
|
||||
|
||||
try {
|
||||
// Is the path a file
|
||||
if (setting == REC_LIST_FILES && fs::is_regular_file(fs_path)) {
|
||||
if ((setting & (REC_EVENT_OPT | REC_LIST_FILES)) > 0 &&
|
||||
fs::is_regular_file(fs_path)) {
|
||||
results.push_back(fs_path.string());
|
||||
return Status(0, "OK");
|
||||
}
|
||||
|
@ -232,6 +232,17 @@ TEST_F(FilesystemTests, test_dotdot_relative) {
|
||||
EXPECT_TRUE(found);
|
||||
}
|
||||
|
||||
TEST_F(FilesystemTests, test_no_wild) {
|
||||
std::vector<std::string> all;
|
||||
auto status = resolveFilePattern(kFakeDirectory + "/roto.txt",
|
||||
all, REC_LIST_FILES);
|
||||
EXPECT_TRUE(status.ok());
|
||||
EXPECT_EQ(all.size(), 1);
|
||||
EXPECT_NE(std::find(all.begin(), all.end(),
|
||||
kFakeDirectory + "/roto.txt"),
|
||||
all.end());
|
||||
}
|
||||
|
||||
TEST_F(FilesystemTests, test_safe_permissions) {
|
||||
// For testing we can request a different directory path.
|
||||
EXPECT_TRUE(safePermissions("/", kFakeDirectory + "/door.txt"));
|
||||
|
Loading…
Reference in New Issue
Block a user