mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-24 14:22:28 +00:00
Emulate ENOTDIR better
This commit is contained in:
parent
b76b2be2d0
commit
8d1c81ac9f
35 changed files with 80 additions and 50 deletions
|
@ -17,6 +17,7 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/struct/stat.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/limits.h"
|
||||
#include "libc/mem/gc.h"
|
||||
|
@ -82,3 +83,12 @@ TEST(zipos_O_DIRECTORY, blocksOpeningOfNormalFiles) {
|
|||
ASSERT_SYS(ENOTDIR, -1,
|
||||
open("/zip/libc/testlib/hyperion.txt", O_RDONLY | O_DIRECTORY));
|
||||
}
|
||||
|
||||
TEST(zipos, trailingComponents_willEnodirFile) {
|
||||
struct stat st;
|
||||
ASSERT_SYS(ENOTDIR, -1, open("/zip/libc/testlib/hyperion.txt/", O_RDONLY));
|
||||
ASSERT_SYS(ENOTDIR, -1, open("/zip/libc/testlib/hyperion.txt/.", O_RDONLY));
|
||||
ASSERT_SYS(ENOTDIR, -1, open("/zip/libc/testlib/hyperion.txt/./", O_RDONLY));
|
||||
ASSERT_SYS(ENOTDIR, -1, open("/zip/libc/testlib/hyperion.txt/a/b", O_RDONLY));
|
||||
ASSERT_SYS(ENOTDIR, -1, stat("/zip/libc/testlib/hyperion.txt/", &st));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue