diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2018-01-12 18:12:24 +0300 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2018-02-07 14:35:25 -0500 |
commit | 23ddab8569ef8ae3488c1d67b6bccaa081c73245 (patch) | |
tree | 2cd09237b8f5d06edb2ed38fab5934a9f818b106 /src/string | |
parent | 376b3c54bba7d235e5a8e2839bb333a826b19636 (diff) | |
download | musl-23ddab8569ef8ae3488c1d67b6bccaa081c73245.tar.gz |
make getcwd fail if it cannot obtain an absolute path
Currently getcwd(3) can succeed without returning an absolute path
because the underlying getcwd syscall, starting with linux commit
v2.6.36-rc1~96^2~2, may succeed without returning an absolute path.
This is a conformance issue because "The getcwd() function shall
place an absolute pathname of the current working directory
in the array pointed to by buf, and return buf".
Fix this by checking the path returned by syscall and failing with
ENOENT if the path is not absolute. The error code is chosen for
consistency with the case when the current directory is unlinked.
Similar issue was fixed in glibc recently, see
https://sourceware.org/bugzilla/show_bug.cgi?id=22679
Diffstat (limited to 'src/string')
0 files changed, 0 insertions, 0 deletions