[Bug 1739] getcwd does not support size zero argument on Solaris
bugzilla-daemon at bugzilla.mindrot.org
bugzilla-daemon at bugzilla.mindrot.org
Fri Mar 26 04:54:58 EST 2010
https://bugzilla.mindrot.org/show_bug.cgi?id=1739
--- Comment #1 from Yann Rouillard <yann at pleiades.fr.eu.org> 2010-03-26 04:54:57 EST ---
Created an attachment (id=1821)
--> (https://bugzilla.mindrot.org/attachment.cgi?id=1821)
A little patch to fix the getcwd function usage
Here is a little patch to solve this bug.
It just passes PATH_MAX as the size argument instead of 0.
The allocated space will be often a lot bigger than needed but:
- the cwd string variable is very short-lived so that is not so
important,
- when passed a 0 size argument, getcwd under linux seems to allocate
PATH_MAX bytes and realloc to exact string size once it has retrieved
the current directory. So it seems we just avoid a realloc call by
using PATH_MAX instead of 0.
--
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching the assignee of the bug.
More information about the openssh-bugs
mailing list