On 4/26/07, koreth@midwinter.com [off-list ref] wrote:
Signed-off-by: Steven Grimm <redacted>
---
Is the +1 really needed? The existing code is doing this in other places
No, not according SUSv3, where PATH_MAX is defined as
"Maximum number of bytes in a pathname, including the terminating null
character."
http://www.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html#tag_13_24
getcwd expects the size of the buffer, so it can store the cwd _and_ NUL.
See ERANGE in in SUSv3:
http://www.opengroup.org/onlinepubs/009695399/functions/getcwd.html
but I'm not sure it's necessary since we're also doing sizeof(buffer)-1
The -1 is wrong too.
in the getcwd() call. I figured it was best to be consistent with the
existing code, e.g. setup_git_directory_gently().
setup_git_directory_gently is wrong. But it does not really
matter in practice.