Fix handling of paths with dirfd on Windows

This change fixes an issue with all system calls ending with *at(), when
the caller passes `dirfd != AT_FDCWD` and an absolute path. It's because
the old code was turning paths like C:\bin\ls into \\C:\bin\ls\C:\bin\ls
after being converted from paths like /C/bin/ls. I noticed this when the
Emacs dired mode stopped working. It's unclear if it's a regression with
Cosmopolitan Libc or if this was introduced by the Emacs v29 upgrade. It
also impacted posix_spawn() for which a newly minted example now exists.
This commit is contained in:
Justine Tunney 2024-09-01 16:35:48 -07:00
parent a089c07ddc
commit 39e7f24947
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
10 changed files with 373 additions and 46 deletions

View file

@ -12,7 +12,8 @@
#define POSIX_SPAWN_SETSCHEDPARAM 16
#define POSIX_SPAWN_SETSCHEDULER 32
#define POSIX_SPAWN_SETSID 128
#define POSIX_SPAWN_SETRLIMIT 256
#define POSIX_SPAWN_SETRLIMIT_NP 256
#define POSIX_SPAWN_USEFORK 512
COSMOPOLITAN_C_START_
@ -55,10 +56,10 @@ int posix_spawnattr_getsigdefault(const posix_spawnattr_t *,
sigset_t *) libcesque;
int posix_spawnattr_setsigdefault(posix_spawnattr_t *,
const sigset_t *) libcesque;
int posix_spawnattr_getrlimit(const posix_spawnattr_t *, int,
struct rlimit *) libcesque;
int posix_spawnattr_setrlimit(posix_spawnattr_t *, int,
const struct rlimit *) libcesque;
int posix_spawnattr_getrlimit_np(const posix_spawnattr_t *, int,
struct rlimit *) libcesque;
int posix_spawnattr_setrlimit_np(posix_spawnattr_t *, int,
const struct rlimit *) libcesque;
COSMOPOLITAN_C_END_
#endif /* COSMOPOLITAN_LIBC_STDIO_SPAWN_H_ */