* fhandler.h: Rename FH_W95LSBUG flag to FH_LSEEKED.
(fhandler_base::set_did_lseek): Rename from set_check_win95_lseek_bug. (fhandler_base::get_did_lseek): Rename from get_check_win95_lseek_bug. (fhandler_base::set_fs_flags): New method. (fhandler_base::get_fs_flags): Ditto. * fhandler.cc (fhandler_base::write): Make 64 bit clean. Convert file to a "sparse" file when writing after a long lseek (>64K) beyond EOF. (fhandler_base::lseek): Call set_did_lseek() instead of set_check_win95_lseek_bug(). (fhandler_base::fhandler_base): Initialize fs_flags to 0. * fhandler_disk_file.cc (fhandler_disk_file::open): Don't create files as "sparse" unconditionally. Set fs_flags member.
This commit is contained in:
@ -26,7 +26,6 @@ details. */
|
||||
#include "pinfo.h"
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <winioctl.h>
|
||||
|
||||
#define _COMPILING_NEWLIB
|
||||
#include <dirent.h>
|
||||
@ -395,19 +394,7 @@ fhandler_disk_file::open (path_conv *real_path, int flags, mode_t mode)
|
||||
&& !allow_ntsec && allow_ntea)
|
||||
set_file_attribute (has_acls (), get_win32_name (), mode);
|
||||
|
||||
/* Set newly created and truncated files as sparse files. */
|
||||
if ((real_path->fs_flags () & FILE_SUPPORTS_SPARSE_FILES)
|
||||
&& (get_access () & GENERIC_WRITE) == GENERIC_WRITE
|
||||
&& (get_flags () & (O_CREAT | O_TRUNC)))
|
||||
{
|
||||
DWORD dw;
|
||||
HANDLE h = get_handle ();
|
||||
BOOL r = DeviceIoControl (h , FSCTL_SET_SPARSE, NULL, 0, NULL, 0, &dw,
|
||||
NULL);
|
||||
syscall_printf ("%d = DeviceIoControl(0x%x, FSCTL_SET_SPARSE, NULL, 0, "
|
||||
"NULL, 0, &dw, NULL)", r, h);
|
||||
}
|
||||
|
||||
set_fs_flags (real_path->fs_flags ());
|
||||
set_symlink_p (real_path->issymlink ());
|
||||
set_execable_p (real_path->exec_state ());
|
||||
set_socket_p (real_path->issocket ());
|
||||
|
Reference in New Issue
Block a user