diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2024-10-07 07:33:58 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2024-10-07 07:33:58 +0200 |
commit | 0929a129fc75c556de67877491281e0bc3ef3edd (patch) | |
tree | 84ea191942bcceea5769fce782ad877c1ee341b3 /coreutils/test.c | |
parent | 96b0607302500ed201a7816282efbaa8f990aa33 (diff) | |
download | busybox-w32-0929a129fc75c556de67877491281e0bc3ef3edd.tar.gz busybox-w32-0929a129fc75c556de67877491281e0bc3ef3edd.tar.bz2 busybox-w32-0929a129fc75c556de67877491281e0bc3ef3edd.zip |
test: -x can return 0/1 early if all X bits are the same
function old new delta
nexpr 702 725 +23
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/test.c')
-rw-r--r-- | coreutils/test.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/coreutils/test.c b/coreutils/test.c index 6085d6663..b63e33cc0 100644 --- a/coreutils/test.c +++ b/coreutils/test.c | |||
@@ -654,16 +654,16 @@ static int test_st_mode(struct stat *st, int mode) | |||
654 | enum { ANY_IX = S_IXUSR | S_IXGRP | S_IXOTH }; | 654 | enum { ANY_IX = S_IXUSR | S_IXGRP | S_IXOTH }; |
655 | unsigned euid; | 655 | unsigned euid; |
656 | 656 | ||
657 | //TODO if (mode == X_OK) { | 657 | if (mode == X_OK) { |
658 | // /* Do we already know with no extra syscalls? */ | 658 | /* Do we already know with no extra syscalls? */ |
659 | // //if (!S_ISREG(st->st_mode)) | 659 | //if (!S_ISREG(st->st_mode)) |
660 | // // return 0; /* not a regular file */ | 660 | // return 0; /* not a regular file */ |
661 | // // ^^^ bash does not check this | 661 | // ^^^ bash 5.2.15 "test -x" does not check this! |
662 | // if ((st->st_mode & ANY_IX) == 0) | 662 | if ((st->st_mode & ANY_IX) == 0) |
663 | // return 0; /* no one can execute */ | 663 | return 0; /* no one can execute */ |
664 | // if ((st->st_mode & ANY_IX) == ANY_IX) | 664 | if ((st->st_mode & ANY_IX) == ANY_IX) |
665 | // return 1; /* anyone can execute */ | 665 | return 1; /* anyone can execute */ |
666 | // } | 666 | } |
667 | 667 | ||
668 | euid = get_cached_euid(&groupinfo->euid); | 668 | euid = get_cached_euid(&groupinfo->euid); |
669 | if (euid == 0) { | 669 | if (euid == 0) { |