Skip to content

Commit

Permalink
Cleanup from PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mlw committed May 16, 2024
1 parent 66c5d1f commit 4f64f24
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions Source/santad/EventProviders/EndpointSecurity/Message.mm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

#include <bsm/libbsm.h>
#include <libproc.h>
#include <sys/errno.h>
#include <sys/stat.h>

#include "Source/santad/EventProviders/EndpointSecurity/EndpointSecurityAPI.h"
Expand Down Expand Up @@ -63,17 +62,13 @@
es_msg_->event.exec.target && es_msg_->event.exec.target->executable) {
struct stat &es_sb = es_msg_->event.exec.target->executable->stat;
struct stat sb;
errno = 0;
int ret = stat(es_msg_->event.exec.target->executable->path.data, &sb);
// If stat failed, or if devno/inode changed, update state.
if (ret != 0 || es_sb.st_ino != sb.st_ino || es_sb.st_dev != sb.st_dev) {
stat_change_step_ = step;
// Determine the specific condition that failed for tracking purposes
if (ret != 0) {
stat_result_ = santa::santad::StatResult::kStatError;
} else {
stat_result_ = santa::santad::StatResult::kDevnoInodeMismatch;
}
stat_result_ = (ret != 0) ? santa::santad::StatResult::kStatError
: santa::santad::StatResult::kDevnoInodeMismatch;
}
}
}
Expand Down

0 comments on commit 4f64f24

Please sign in to comment.