mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-29 08:42:28 +00:00
Improve zip read-only filesystem
readdir() will now always yield an inode that's consistent with stat() on ZipOS and Windows in general. More APIs have been updated to return the appropriate error code when inappropriately trying to do ops, like sockets, with a zip file descriptor. The path normalization algorithms are now fully fleshed out. Some socket APIs have been fixed so they'll raise EBADF vs. ENOTSOCK appropriately. Lastly seekdir() will now work properly on NetBSD and FreeBSD (not sure why anyone would even use it)
This commit is contained in:
parent
dc6c67256f
commit
b76b2be2d0
47 changed files with 644 additions and 269 deletions
|
@ -17,7 +17,9 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/internal.h"
|
||||
#include "libc/calls/syscall-sysv.internal.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
|
||||
/**
|
||||
* Syncs filesystem associated with file descriptor.
|
||||
|
@ -30,8 +32,13 @@
|
|||
* @raise ENOSPC if disk space was exhausted during sync
|
||||
* @raise EDQUOT (or ENOSPC) on some kinds of NFS errors
|
||||
* @raise EBADF if `fd` isn't a valid file descriptor
|
||||
* @raise EROFS if `fd` is a zip file
|
||||
* @raise ENOSYS on non-Linux
|
||||
*/
|
||||
int syncfs(int fd) {
|
||||
return sys_syncfs(fd);
|
||||
if (fd < g_fds.n && g_fds.p[fd].kind == kFdZip) {
|
||||
return erofs();
|
||||
} else {
|
||||
return sys_syncfs(fd);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue