Re: [patch] solaris getcwd() brokeness
| From: | James E. Flemer | Date: | Sun, 23 Feb 2003 23:29:45 +0000 |
| Subject: | Re: [patch] solaris getcwd() brokeness | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-94518@lists.php.net to get a copy of this message | ||
Oh good, it hasn't been forgotten. I just want to point
out that if committed the open() statement should probably
use O_RDONLY. [main.c @ ~1542] I used 0 because I didn't
have time to figure out where to add the correct #include
to get O_RDONLY into main.c.
-James
On Sun, 23 Feb 2003, Wez Furlong wrote:
> Hi Andi (and James)
>
> Andi: I'd appreciate your comments on this patch, specifically if there
> are any concerns about it doing the right thing.
>
> Most people here:
> http://bugs.php.net/bug.php?id=21310&edit=1
>
> report that it fixes their problems with solaris.
>
> I've held off from looking at this, as I didn't want to duplicate any
> effort you have been making.
>
> --Wez.
>
> On Sun, 16 Feb 2003, Andi Gutmans wrote:
>
> > At 03:41 PM 2/13/2003 -0500, James E. Flemer wrote:
> > >RCS file: /repository/TSRM/tsrm_virtual_cwd.c,v
> > >retrieving revision 1.41
> > >diff -u -b -r1.41 tsrm_virtual_cwd.c
> > >--- TSRM/tsrm_virtual_cwd.c 6 Nov 2002 18:07:22 -0000 1.41
> > >+++ TSRM/tsrm_virtual_cwd.c 13 Feb 2003 20:40:07 -0000
> > >@@ -303,7 +303,7 @@
> > > return (0);
> > >
> > > #if !defined(TSRM_WIN32) && !defined(NETWARE)
> > >- if (IS_ABSOLUTE_PATH(path, path_length)) {
> > >+ if (IS_ABSOLUTE_PATH(path, path_length) || (state->cwd_length < 1)) {
> > > if (use_realpath && realpath(path, resolved_path)) {
> > > path = resolved_path;
> > > path_length = strlen(path);
> >
> > Will realpath() work in cases where getcwd() didn't work? (btw it's nicer
> > to check state->cwd_length == 0 than < 1 IMO).
> >
> > >@@ -363,6 +363,7 @@
> > > }
> > >
> > >
> > >+ if (state->cwd_length > 0 || IS_ABSOLUTE_PATH(path, path_length)) {
> > > ptr = tsrm_strtok_r(path_copy, TOKENIZER_STRING, &tok);
> > > while (ptr) {
> > > ptr_length = strlen(ptr);
> > >@@ -416,6 +417,11 @@
> > > state->cwd[state->cwd_length+1] = '\0';
> > > state->cwd_length++;
> > > }
> > >+ } else {
> > >+ state->cwd = (char *) realloc(state->cwd, path_length+1);
> > >+ memcpy(state->cwd, path, path_length+1);
> > >+ state->cwd_length = path_length;
> > >+ }
> >
> > I'm trying to think if there's some other way of doing this. What is the
> > main problem in this loop? Does it add / or c:\ in the beginning of the
> > string?
> >
> > Andi
> >
> >
> > --
> > PHP Development Mailing List <http://www.php.net/>
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
>