]> granicus.if.org Git - php/commitdiff
Add in missing stat element and fix win32 build
authorSara Golemon <pollita@php.net>
Sat, 29 Nov 2003 20:01:00 +0000 (20:01 +0000)
committerSara Golemon <pollita@php.net>
Sat, 29 Nov 2003 20:01:00 +0000 (20:01 +0000)
ext/standard/ftp_fopen_wrapper.c

index 2bc78ac1be342b9218fe684852fd7e816282742d..6d4014fdd902f165f7ffa545d47426eedde1c58b 100644 (file)
@@ -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;