diff options
author | Guido van Rossum <guido@python.org> | 1995-08-08 14:09:33 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1995-08-08 14:09:33 (GMT) |
commit | 08d2071accbf0efd86235d9fb7533629d7c42d7c (patch) | |
tree | f53440ea81efeda025f8a56bf10345ef97d6252b /Mac/Compat | |
parent | 6d47d0d07e4241b854c3c4fefe28fbd18da6fd94 (diff) | |
download | cpython-08d2071accbf0efd86235d9fb7533629d7c42d7c.zip cpython-08d2071accbf0efd86235d9fb7533629d7c42d7c.tar.gz cpython-08d2071accbf0efd86235d9fb7533629d7c42d7c.tar.bz2 |
set some fields to zero for directories
Diffstat (limited to 'Mac/Compat')
-rw-r--r-- | Mac/Compat/macstat.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Mac/Compat/macstat.c b/Mac/Compat/macstat.c index 0f690e0..a1265af 100644 --- a/Mac/Compat/macstat.c +++ b/Mac/Compat/macstat.c @@ -54,11 +54,13 @@ macstat(path, buf) buf->st_nlink = 1; buf->st_uid = 1; buf->st_gid = 1; - buf->st_size = pb.f.ioFlLgLen; + buf->st_size = (buf->st_mode & S_IFDIR) ? 0 : pb.f.ioFlLgLen; buf->st_mtime = buf->st_atime = pb.f.ioFlMdDat; buf->st_ctime = pb.f.ioFlCrDat; - buf->st_rsize = pb.f.ioFlRLgLen; - *(unsigned long *)buf->st_type = pb.f.ioFlFndrInfo.fdType; - *(unsigned long *)buf->st_creator = pb.f.ioFlFndrInfo.fdCreator; + buf->st_rsize = (buf->st_mode & S_IFDIR) ? 0 : pb.f.ioFlRLgLen; + *(unsigned long *)buf->st_type = + (buf->st_mode & S_IFDIR) ? 0 : pb.f.ioFlFndrInfo.fdType; + *(unsigned long *)buf->st_creator = + (buf->st_mode & S_IFDIR) ? 0 : pb.f.ioFlFndrInfo.fdCreator; return 0; } |