OSDN Git Service

fix errno value for getcwd when size argument is zero
authorRich Felker <dalias@aerifal.cx>
Tue, 8 Oct 2013 23:49:10 +0000 (19:49 -0400)
committerRich Felker <dalias@aerifal.cx>
Tue, 8 Oct 2013 23:49:10 +0000 (19:49 -0400)
commit4fb7df12f52982412e60afeaf9c4463f78b396fc
tree8e32da083c9881ced7a9fdb709289a7d28ce0e35
parent8f438115f2c12b40fa7b1884f87db72857af67f6
fix errno value for getcwd when size argument is zero

based on patch by Michael Forney. at the same time, I've changed the
if branch to be more clear, avoiding the comma operator.

the underlying issue is that Linux always returns ERANGE when size is
too short, even when it's zero, rather than returning EINVAL for the
special case of zero as required by POSIX.
src/unistd/getcwd.c