summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_disk_file.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2003-05-25 09:18:43 +0000
committerCorinna Vinschen <corinna@vinschen.de>2003-05-25 09:18:43 +0000
commita80229fd4934b438677ec3ac2a7cb9f369c0050c (patch)
treee5684e765ac36191b7e56455ebda72fbf790807d /winsup/cygwin/fhandler_disk_file.cc
parentc295ce6f6e18cac30b0e5313cecad9fdab1809c6 (diff)
downloadcygnal-a80229fd4934b438677ec3ac2a7cb9f369c0050c.tar.gz
cygnal-a80229fd4934b438677ec3ac2a7cb9f369c0050c.tar.bz2
cygnal-a80229fd4934b438677ec3ac2a7cb9f369c0050c.zip
* autoload.cc (GetDiskFreeSpaceEx): Add.
* syscalls.cc (statfs): Call full_path.root_dir() instead of rootdir(full_path). Use GetDiskFreeSpaceEx when available and report space available in addition to free space. * fhandler_disk_file.cc (fhandler_disk_file::fstat_by_name): Do not call FindFirstFile for disk root directories.
Diffstat (limited to 'winsup/cygwin/fhandler_disk_file.cc')
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc49
1 files changed, 18 insertions, 31 deletions
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index bd235b35d..98d1531f4 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -109,39 +109,26 @@ fhandler_disk_file::fstat_by_name (struct __stat64 *buf, path_conv *pc)
set_errno (ENOENT);
res = -1;
}
+ else if (pc->isdir () && strlen (*pc) <= strlen (pc->root_dir ()))
+ {
+ FILETIME ft = {};
+ res = fstat_helper (buf, pc, ft, ft, ft, 0, 0);
+ }
+ else if ((handle = FindFirstFile (*pc, &local)) == INVALID_HANDLE_VALUE)
+ {
+ debug_printf ("FindFirstFile failed for '%s', %E", (char *) *pc);
+ __seterrno ();
+ res = -1;
+ }
else
{
- char drivebuf[5];
- char *name;
- if ((*pc)[3] != '\0' || !isalpha ((*pc)[0]) || (*pc)[1] != ':' || (*pc)[2] != '\\')
- name = *pc;
- else
- {
- /* FIXME: Does this work on empty disks? */
- drivebuf[0] = (*pc)[0];
- drivebuf[1] = (*pc)[1];
- drivebuf[2] = (*pc)[2];
- drivebuf[3] = '*';
- drivebuf[4] = '\0';
- name = drivebuf;
- }
-
- if ((handle = FindFirstFile (name, &local)) == INVALID_HANDLE_VALUE)
- {
- debug_printf ("FindFirstFile failed for '%s', %E", name);
- __seterrno ();
- res = -1;
- }
- else
- {
- FindClose (handle);
- res = fstat_helper (buf, pc,
- local.ftCreationTime,
- local.ftLastAccessTime,
- local.ftLastWriteTime,
- local.nFileSizeHigh,
- local.nFileSizeLow);
- }
+ FindClose (handle);
+ res = fstat_helper (buf, pc,
+ local.ftCreationTime,
+ local.ftLastAccessTime,
+ local.ftLastWriteTime,
+ local.nFileSizeHigh,
+ local.nFileSizeLow);
}
return res;
}