[Issue 1105] std.c.linux.linux.stat fails for files > 2GB
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Apr 25 10:49:14 PDT 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1105
thomas-dloop at kuehne.cn changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
------- Comment #1 from thomas-dloop at kuehne.cn 2007-04-25 12:49 -------
This is a C issue. The below C code shows the same symbtoms like the above D
code:
# #include <sys/stat.h>
# #include <stdio.h>
# #include <errno.h>
#
# int main(){
# struct stat meta;
# int code = stat("/tmp/test.dat", &meta);
#
# if(0 == code){
# printf("isdir: %i\n", S_ISDIR(meta.st_mode));
# }else{
# printf("errno: %i\n", errno);
# }
#
# return 0;
# }
While this issue can be by-passed via stat64 (below) stat64 isn't guaranteed to
be present (most current Linux system should support it but some odler ones
don't):
# #define _LARGEFILE64_SOURCE 1
# #include <sys/stat.h>
# #include <stdio.h>
# #include <errno.h>
#
# int main(){
# struct stat64 meta;
# int code = stat64("/tmp/test.dat", &meta);
#
# if(0 == code){
# printf("isdir: %i\n", S_ISDIR(meta.st_mode));
# }else{
# printf("errno: %i\n", errno);
# }
#
# return 0;
# }
--
More information about the Digitalmars-d-bugs
mailing list