diff --git a/src/libpsl-native/src/isexecutable.cpp b/src/libpsl-native/src/isexecutable.cpp index c702ccf3ba..81e00fba23 100644 --- a/src/libpsl-native/src/isexecutable.cpp +++ b/src/libpsl-native/src/isexecutable.cpp @@ -4,7 +4,7 @@ #include "isexecutable.h" -#include +#include #include #include @@ -19,22 +19,12 @@ //! char* is marshaled as an LPStr, which on Linux is UTF-8. //! @endparblock //! -//! @exception errno Passes these errors via errno to GetLastError: -//! - ERROR_INVALID_ADDRESS: attempt to access invalid address -//! //! @retval true if path is an executable, false otherwise //! bool IsExecutable(const char* path) { - errno = 0; - - // Check parameters - if (!path) - { - errno = ERROR_INVALID_PARAMETER; - return false; - } + assert(path); return access(path, X_OK) != -1; } diff --git a/src/libpsl-native/test/test-isexecutable.cpp b/src/libpsl-native/test/test-isexecutable.cpp index d97d7d3159..0ccfd40317 100644 --- a/src/libpsl-native/test/test-isexecutable.cpp +++ b/src/libpsl-native/test/test-isexecutable.cpp @@ -47,17 +47,11 @@ protected: } }; -TEST_F(IsExecutableTest, FilePathNameIsNull) -{ - EXPECT_FALSE(IsExecutable(NULL)); - EXPECT_EQ(ERROR_INVALID_PARAMETER, errno); -} - TEST_F(IsExecutableTest, FilePathNameDoesNotExist) { std::string invalidFile = "/tmp/isexecutabletest_invalidFile"; EXPECT_FALSE(IsExecutable(invalidFile.c_str())); - EXPECT_EQ(ERROR_FILE_NOT_FOUND, errno); + EXPECT_EQ(ENOENT, errno); } TEST_F(IsExecutableTest, NormalFileIsNotIsexecutable)