mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
Fix some more issues
- ARM Neon headers are now exported in libc/isystem/ - stat() and access() now do a better job reporting which files are executable which ones aren't. They do this by reading the first two bytes in a file to see if it's `MZ` or `#!`.
This commit is contained in:
parent
22cf6e11eb
commit
4f5d5a6813
17 changed files with 144 additions and 49 deletions
|
@ -33,7 +33,6 @@
|
|||
#include "libc/sysv/consts/nr.h"
|
||||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
#include "libc/x/x.h"
|
||||
|
||||
__static_yoink("zipos");
|
||||
|
||||
|
@ -61,6 +60,31 @@ TEST(stat, enotdir) {
|
|||
ASSERT_SYS(ENOTDIR, -1, stat("yo/there", &st));
|
||||
}
|
||||
|
||||
TEST(stat, textFileIsntExecutable) {
|
||||
struct stat st;
|
||||
ASSERT_SYS(0, 0, touch("foo.txt", 0644));
|
||||
ASSERT_SYS(0, 0, stat("foo.txt", &st));
|
||||
ASSERT_FALSE(st.st_mode & 0111);
|
||||
}
|
||||
|
||||
TEST(stat, shebangIsExecutable) {
|
||||
struct stat st;
|
||||
ASSERT_SYS(0, 3, creat("foo.sh", 0777));
|
||||
ASSERT_SYS(0, 2, write(3, "#!", 2));
|
||||
ASSERT_SYS(0, 0, close(3));
|
||||
ASSERT_SYS(0, 0, stat("foo.sh", &st));
|
||||
ASSERT_TRUE(!!(st.st_mode & 0111));
|
||||
}
|
||||
|
||||
TEST(stat, portableExecutableIsExecutable) {
|
||||
struct stat st;
|
||||
ASSERT_SYS(0, 3, creat("foo.exe", 0777));
|
||||
ASSERT_SYS(0, 2, write(3, "MZ", 2));
|
||||
ASSERT_SYS(0, 0, close(3));
|
||||
ASSERT_SYS(0, 0, stat("foo.exe", &st));
|
||||
ASSERT_TRUE(!!(st.st_mode & 0111));
|
||||
}
|
||||
|
||||
TEST(stat, zipos) {
|
||||
struct stat st;
|
||||
EXPECT_SYS(0, 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue