Skip to content

Commit

Permalink
tests: Fix flaky ProcessOpenFilesTest.test_sanity test (osquery#6185)
Browse files Browse the repository at this point in the history
  • Loading branch information
theopolis authored Feb 29, 2020
1 parent 036ef01 commit 983d2a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion osquery/filesystem/linux/proc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ Status procReadDescriptor(const std::string& process,
result = std::string(result_path);
return Status(0);
} else {
return Status(1, "Could not read path");
return Status(1, "Could not call readlink: " + kLinuxProcPath);
}
}

Expand Down
5 changes: 3 additions & 2 deletions osquery/filesystem/linux/proc.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,9 @@ Status procEnumerateProcessDescriptors(const std::string& pid,
std::string link;
Status status = procReadDescriptor(pid, fd, link);
if (!status.ok()) {
VLOG(1) << "Failed to read the link for file descriptor " << fd
<< " of pid " << pid << ". Data might be incomplete.";
// Likely because the file descriptor was closed before readlink.
VLOG(1) << status.getMessage();
continue;
}

bool ret = callback(pid, fd, link, user_data);
Expand Down

0 comments on commit 983d2a3

Please sign in to comment.