[Bug java/9532] jar -C flag is incompatible with Sun's (fastjar uses nonportable feature of getcwd)
neroden at twcny dot rr dot com
gcc-bugzilla@gcc.gnu.org
Thu Jul 3 16:36:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9532
------- Additional Comments From neroden at twcny dot rr dot com 2003-07-03 16:36 -------
Subject: Re: jar -C flag is incompatible with Sun's (fastjar
uses nonportable feature of getcwd)
>>Buffer won't be allocated recursively.
My previous fix did cause potential recursive allocation of many many
1024-byte buffers on the stack (although it was totally wasted since all
but the top one were definitely unused), so I was intent on fixing that
before it caused an out-of-memory crash. :-/ Hence the comment here.
jim dot balter at cw dot com wrote:
> No disagreement, but I *still* think it would be better
> (faster, more efficient) to allocate the buffer just once,
> statically, and reuse the result:
>
> static char old_dir[MAXPATHLEN];
> ...
> /* getcwd if we didn't already */
> if(!*old_dir && !getcwd(old_dir, sizeof old_dir)){
> ...
Yeah, probably. It's been tedious getting these patches through the
system though, and I've got other work to do. Also, I'm far from an
expert on using 'static' correctly and safely in C; I don't trust
myself. Feel free to submit the patch you just described to
gcc-patches@gcc.gnu.org, and I'll try to get it reviewed and committed.
Thanks for all your feedback.
More information about the Gcc-bugs
mailing list