diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2007-05-29 17:25:36 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2007-05-29 17:25:36 +0000 |
commit | ad4e943fca1d5f03a1d23c742365d39d374ff942 (patch) | |
tree | e592a3480766d8ef3569fa54bcf5c0eef7100c05 /winsup/cygwin/fhandler_disk_file.cc | |
parent | 8a11b13ff0f6d3e673f23060dca76d6358f4ac3f (diff) | |
download | cygnal-ad4e943fca1d5f03a1d23c742365d39d374ff942.tar.gz cygnal-ad4e943fca1d5f03a1d23c742365d39d374ff942.tar.bz2 cygnal-ad4e943fca1d5f03a1d23c742365d39d374ff942.zip |
* dtable.cc (dtable::set_file_pointers_for_exec): Call SetFilePointer
correctly for 64 bit file access. Comment out functionality.
* fhandler.cc (fhandler_base::open): Don't set append_mode.
(fhandler_base::write): Check for O_APPEND instead of append_mode.
Call SetFilePointer correctly for 64 bit file access. Handle
errors from SetFilePointer.
* fhandler.h (class fhandler_base): Drop append_mode status flag.
* fhandler_disk_file.cc (fhandler_base::fstat_helper): Handle
seeking correctly for 64 bit file access.
Diffstat (limited to 'winsup/cygwin/fhandler_disk_file.cc')
-rw-r--r-- | winsup/cygwin/fhandler_disk_file.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index d510ff0f0..353c45ba5 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -493,13 +493,14 @@ fhandler_base::fstat_helper (struct __stat64 *buf, if (pc.exec_state () == dont_know_if_executable) { DWORD cur, done; + LONG curhigh = 0; char magic[3]; /* First retrieve current position, set to beginning of file if not already there. */ - cur = SetFilePointer (get_handle (), 0, NULL, FILE_CURRENT); - if (cur != INVALID_SET_FILE_POINTER - && (!cur || SetFilePointer (get_handle (), 0, NULL, FILE_BEGIN) + cur = SetFilePointer (get_handle (), 0, &curhigh, FILE_CURRENT); + if ((cur != INVALID_SET_FILE_POINTER || GetLastError () == NO_ERROR) + && ((!cur && !curhigh) || SetFilePointer (get_handle (), 0, NULL, FILE_BEGIN) != INVALID_SET_FILE_POINTER)) { /* FIXME should we use /etc/magic ? */ @@ -510,7 +511,7 @@ fhandler_base::fstat_helper (struct __stat64 *buf, pc.set_exec (); buf->st_mode |= STD_XBITS; } - SetFilePointer (get_handle (), cur, NULL, FILE_BEGIN); + SetFilePointer (get_handle (), cur, &curhigh, FILE_BEGIN); } } } |