diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2005-06-16 15:46:40 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2005-06-16 15:46:40 +0000 |
commit | ec3b136a64f8adaa39f454acefb106952a6139f5 (patch) | |
tree | ba67a6190be553bde9891c214a0419a20725e30e | |
parent | 842db592751e121068a3676817c54dd5b229dc56 (diff) | |
download | cygnal-ec3b136a64f8adaa39f454acefb106952a6139f5.tar.gz cygnal-ec3b136a64f8adaa39f454acefb106952a6139f5.tar.bz2 cygnal-ec3b136a64f8adaa39f454acefb106952a6139f5.zip |
* syscalls.cc (statvfs): Handle the case when GetDiskFreeSpaceEx
succeeds but GetDiskFreeSpace fails by faking bytes-per-sector and
sectors-per-cluster values.
-rw-r--r-- | winsup/cygwin/ChangeLog | 6 | ||||
-rw-r--r-- | winsup/cygwin/syscalls.cc | 19 |
2 files changed, 21 insertions, 4 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 3a465ee50..7011bff6f 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2005-06-16 Corinna Vinschen <corinna@vinschen.de> + + * syscalls.cc (statvfs): Handle the case when GetDiskFreeSpaceEx + succeeds but GetDiskFreeSpace fails by faking bytes-per-sector and + sectors-per-cluster values. + 2005-06-15 Christopher Faylor <cgf@timesys.com> * cygthread.cc (cygthread::detach): Fix debugging output. diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index fa92b1b46..e5bd72c13 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -1731,16 +1731,27 @@ statvfs (const char *fname, struct statvfs *sfs) ULARGE_INTEGER availb, freeb, totalb; DWORD spc, bps, availc, freec, totalc, vsn, maxlen, flags; - BOOL status; + BOOL status, statusex; push_thread_privilege (SE_CHANGE_NOTIFY_PRIV, true); /* GetDiskFreeSpaceEx must be called before GetDiskFreeSpace on WinME, to avoid the MS KB 314417 bug */ - status = GetDiskFreeSpaceEx (root, &availb, &totalb, &freeb); - if (GetDiskFreeSpace (root, &spc, &bps, &freec, &totalc)) + statusex = GetDiskFreeSpaceEx (root, &availb, &totalb, &freeb); + status = GetDiskFreeSpace (root, &spc, &bps, &freec, &totalc); + if (!status && statusex) { - if (status) + /* Grrr, this can happen on 9x when a share isn't attached to + a drive letter. Fake, fake, hoorah. */ + status = TRUE; + bps = 512; + spc = 8; + while ((totalb.QuadPart % (spc*bps)) && spc > 1) + spc >>= 1; + } + if (status) + { + if (statusex) { availc = availb.QuadPart / (spc*bps); totalc = totalb.QuadPart / (spc*bps); |