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 jim.balter@cw.com  2003-06-12 23:58 -------
Subject: Re:  jar -C flag is incompatible with Sun's (fastjar
 uses nonportable feature of getcwd)

On 6/12/03 4:28 PM, neroden@gcc.gnu.org wrote:
> 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
> 
> 
> neroden@gcc.gnu.org changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>            Severity|enhancement                 |normal
>              Status|WAITING                     |NEW
>      Ever Confirmed|                            |1
>    GCC host triplet|                            |solaris-*-*
>    Last reconfirmed|0000-00-00 00:00:00         |2003-06-12 23:27:59
>                date|                            |
>             Summary|jar -C flag is incompatible |jar -C flag is incompatible
>                    |with Sun's                  |with Sun's (fastjar uses
>                    |                            |nonportable feature of
>                    |                            |getcwd)
> 
> 
> ------- Additional Comments From neroden@gcc.gnu.org  2003-06-12 23:27 -------
> Right.  This is multiple bugs. :-(Let's start with the non-portable feature.I don't want to reinvent the wheel.  Is there a possibility of using libiberty's getcwd, which has the "Linux behavior" when the first argument is NULL?

You should be able to use getcwd(NULL, MAXPATHLEN);
I'll leave it up to you to figure out how to determine MAXPATHLEN
portably -- there must be other GNU code that does this, and I'm
not familiar with the configure mechanism.  At worst, you could
use 1024, as that's the usual (nearly universal) value.

And actually, instead of getcwd(NULL, ...), I would do

    char old_dir[MAXBUFLEN];

    if (getcwd(old_dir, sizeof old_dir) == NULL) {
        perror("getcwd");
        return 1;
    }

and then you don't have to free it.


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