This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug java/9532] jar -C flag is incompatible with Sun's (fastjar uses nonportable feature of getcwd)


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]