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