RE:[PHP-DEV] PHP 4.0 Bug #7216: ftp_mkdir returns nothing - fix
| From: | Jason | Date: | Sun, 15 Oct 2000 18:21:41 +0000 |
| Subject: | RE:[PHP-DEV] PHP 4.0 Bug #7216: ftp_mkdir returns nothing - fix | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-35061@lists.php.net to get a copy of this message | ||
This problem is cuased by Solaris's ftp server which does _not_ print
the directory after a successful MKD. According to RFC, anything with
response 257 should be good, but to comply with the style of ftp.c I
just added a condition specific to a successful solaris ftp server
return code. There should be a better way to implement this, else there
is a possibility for this to break on another non-compliant ftp server
out there.
-Jason
*** ftp.c.orig Sun Oct 15 12:37:41 2000
--- ftp.c Sun Oct 15 12:47:35 2000
***************
*** 378,385 ****
return NULL;
/* copy out the dir from response */
! if ((mkd = strchr(ftp->inbuf, '"')) == NULL)
! return NULL;
end = strrchr(++mkd, '"');
*end = 0;
mkd = strdup(mkd);
--- 378,390 ----
return NULL;
/* copy out the dir from response */
! if ((mkd = strchr(ftp->inbuf, '"')) == NULL) {
! if (strstr(ftp->inbuf,"successful")) { /* Solaris FTP Server
*/
! mkd=strdup(dir);
! return mkd;
! } else return NULL;
! }
!
end = strrchr(++mkd, '"');
*end = 0;
mkd = strdup(mkd);