getcwd: return the length of the string instead of just 0

Useful for Go.

Signed-off-by: Ronald G. Minnich <rminnich@google.com>