diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2000-04-25 23:39:05 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2000-04-25 23:39:05 +0400 |
commit | 47eaa6c421031e7f908eb352ebe6905b2d8bcb27 (patch) | |
tree | 2b7acde2deba900bb602ce771132d266ea7f22c4 | |
parent | 8017cc0edd135fb798f276c50b997c8f404595a9 (diff) |
* syscalls.cc (stat_worker): Previous patch failed to stat
each drives root dir on 9X.
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/syscalls.cc | 30 |
2 files changed, 18 insertions, 17 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index f414852b7..01ab1a100 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +Thu Apr 25 21:35:00 2000 Corinna Vinschen <corinna@vinschen.de> + + * syscalls.cc (stat_worker): Previous patch failed to stat + each drives root dir on 9X. + Thu Apr 25 16:37:00 2000 Corinna Vinschen <corinna@vinschen.de> * fhandler.cc (fhandler_disk_file::open): Check for allow_ntsec diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 1200d3642..e5f087161 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -979,7 +979,6 @@ stat_worker (const char *caller, const char *name, struct stat *buf, { int res = -1; int atts; - char *win32_name; char root[MAX_PATH]; UINT dtype; fhandler_disk_file fh (NULL); @@ -999,16 +998,15 @@ stat_worker (const char *caller, const char *name, struct stat *buf, memset (buf, 0, sizeof (struct stat)); - win32_name = real_path.get_win32 (); if (real_path.is_device ()) return stat_dev (real_path.get_devn (), real_path.get_unitn (), - hash_path_name (0, win32_name), buf); + hash_path_name (0, real_path.get_win32 ()), buf); atts = real_path.file_attributes (); - debug_printf ("%d = GetFileAttributesA (%s)", atts, win32_name); + debug_printf ("%d = GetFileAttributesA (%s)", atts, real_path.get_win32 ()); - strcpy (root, win32_name); + strcpy (root, real_path.get_win32 ()); dtype = GetDriveType (rootdir (root)); if ((atts == -1 || !(atts & FILE_ATTRIBUTE_DIRECTORY) || @@ -1029,7 +1027,7 @@ stat_worker (const char *caller, const char *name, struct stat *buf, let's try it with `1' as link count. */ if (atts != -1 && (atts & FILE_ATTRIBUTE_DIRECTORY)) buf->st_nlink = - (dtype == DRIVE_REMOTE ? 1 : num_entries (win32_name)); + (dtype == DRIVE_REMOTE ? 1 : num_entries (real_path.get_win32 ())); } else if (atts != -1 || GetLastError () != ERROR_FILE_NOT_FOUND) { @@ -1041,7 +1039,7 @@ stat_worker (const char *caller, const char *name, struct stat *buf, if (atts != -1 && (atts & FILE_ATTRIBUTE_DIRECTORY) && dtype != DRIVE_REMOTE) - buf->st_nlink = num_entries (win32_name); + buf->st_nlink = num_entries (real_path.get_win32 ()); buf->st_dev = FHDEVN(FH_DISK) << 8; buf->st_ino = hash_path_name (0, real_path.get_win32 ()); if (atts != -1 && (atts & FILE_ATTRIBUTE_DIRECTORY)) @@ -1063,18 +1061,16 @@ stat_worker (const char *caller, const char *name, struct stat *buf, NULL, &buf->st_uid, &buf->st_gid); } if ((handle = FindFirstFile (real_path.get_win32(), &wfd)) - == INVALID_HANDLE_VALUE) + != INVALID_HANDLE_VALUE) { - __seterrno (); - goto done; + buf->st_atime = to_time_t (&wfd.ftLastAccessTime); + buf->st_mtime = to_time_t (&wfd.ftLastWriteTime); + buf->st_ctime = to_time_t (&wfd.ftCreationTime); + buf->st_size = wfd.nFileSizeLow; + buf->st_blksize = S_BLKSIZE; + buf->st_blocks = (buf->st_size + S_BLKSIZE-1) / S_BLKSIZE; + FindClose (handle); } - buf->st_atime = to_time_t (&wfd.ftLastAccessTime); - buf->st_mtime = to_time_t (&wfd.ftLastWriteTime); - buf->st_ctime = to_time_t (&wfd.ftCreationTime); - buf->st_size = wfd.nFileSizeLow; - buf->st_blksize = S_BLKSIZE; - buf->st_blocks = (buf->st_size + S_BLKSIZE-1) / S_BLKSIZE; - FindClose (handle); res = 0; } |