mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-06 11:18:30 +00:00
Remove old stack code and improve dirstream
This commit is contained in:
parent
74caabb823
commit
dc6c67256f
61 changed files with 463 additions and 595 deletions
|
@ -21,7 +21,9 @@
|
|||
#include "libc/dce.h"
|
||||
#include "libc/intrin/asan.internal.h"
|
||||
#include "libc/intrin/strace.internal.h"
|
||||
#include "libc/intrin/weaken.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/runtime/zipos.internal.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
|
||||
/**
|
||||
|
@ -30,14 +32,27 @@
|
|||
* This does *not* update the `PWD` environment variable.
|
||||
*
|
||||
* @return 0 on success, or -1 w/ errno
|
||||
* @raise ELOOP if a loop was detected resolving components of `path`
|
||||
* @raise EACCES if search permission was denied on directory
|
||||
* @raise ENOTDIR if component of `path` isn't a directory
|
||||
* @raise ENOMEM if insufficient memory was available
|
||||
* @raise EFAULT if `path` points to invalid memory
|
||||
* @raise ENOTSUP if `path` is a `/zip/...` file
|
||||
* @raise ENAMETOOLONG if `path` was too long
|
||||
* @raise ENOENT if `path` doesn't exist
|
||||
* @raise EIO if an i/o error happened
|
||||
* @asyncsignalsafe
|
||||
* @see fchdir()
|
||||
*/
|
||||
int chdir(const char *path) {
|
||||
int rc;
|
||||
struct ZiposUri zipname;
|
||||
GetProgramExecutableName(); // XXX: ugly workaround
|
||||
if (!path || (IsAsan() && !__asan_is_valid_str(path))) {
|
||||
rc = efault();
|
||||
} else if (_weaken(__zipos_parseuri) &&
|
||||
_weaken(__zipos_parseuri)(path, &zipname) != -1) {
|
||||
rc = enotsup();
|
||||
} else if (!IsWindows()) {
|
||||
rc = sys_chdir(path);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue