diff options
| -rw-r--r-- | ext/standard/ftp_fopen_wrapper.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c index 2bc78ac1be..6d4014fdd9 100644 --- a/ext/standard/ftp_fopen_wrapper.c +++ b/ext/standard/ftp_fopen_wrapper.c @@ -760,6 +760,7 @@ static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, char *url, int f } ssb->sb.st_ino = 0; /* Unknown values */ + ssb->sb.st_dev = 0; ssb->sb.st_uid = 0; ssb->sb.st_gid = 0; ssb->sb.st_atime = -1; @@ -767,9 +768,12 @@ static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, char *url, int f ssb->sb.st_ctime = -1; ssb->sb.st_nlink = 1; ssb->sb.st_rdev = -1; +#ifdef HAVE_ST_BLKSIZE ssb->sb.st_blksize = 4096; /* Guess since FTP won't expose this information */ - ssb->sb.st_blocks = ceil(ssb->sb.st_size / ssb->sb.st_blksize); - +#ifdef HAVE_ST_BLOCKS + ssb->sb.st_blocks = (int)((4095 + ssb->sb.st_size) / ssb->sb.st_blksize); /* emulate ceil */ +#endif +#endif php_stream_close(stream); php_url_free(resource); return 0; |
