A call to getcwd() with a buffer smaller than the actual path returns an error ENAMETOOLONG on all architectures but ia64, whereas POSIX and the *GNU libc manual* say ERANGE. Actually this is the value returned by the kernel. IMHO the kernel has to be fixed, but the GNU libc should also correct the number. That's the purpose of the attached patch.
Created attachment 902 [details] proposed patch
When you say "on all architectures but ia64" do you mean this is true for the generic kernel or is this Debian specific? On OpenSUSE x86 10.0 I get ERANGE. I do not see why glibc should put in a patch to work around a bug in the kernel. This bug should be fixed in the kernel only. If glibc put in a workaround for every simple kernel bug which code be fixed the code would quickly become unmanageable.
s/code be fixed/could be fixed/
There is no problem in libc and I cannot see anything wrong in the current kernel sources either.