这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ for f in tests/*.sh; do
ACTUAL_FILE=$f-actual

rm -f $ACTUAL_FILE
$f myarg1 myarg2 > $ACTUAL_FILE
$f myarg1 myarg2 &> $ACTUAL_FILE

if cmp --silent $ACTUAL_FILE $EXPECTED_FILE; then
printf " OK\n"
Expand Down
3 changes: 3 additions & 0 deletions termux-exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ int execve(const char* filename, char* const* argv, char *const envp[])
char filename_buffer[512];
filename = termux_rewrite_executable(filename, filename_buffer, sizeof(filename_buffer));

// Error out if the file is not executable:
if (access(filename, X_OK) != 0) goto final;

fd = open(filename, O_RDONLY);
if (fd == -1) goto final;

Expand Down
3 changes: 3 additions & 0 deletions tests/not-executable.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

echo hello
1 change: 1 addition & 0 deletions tests/not-executable.sh-expected
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./run-tests.sh: line 12: tests/not-executable.sh: Permission denied