mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-30 02:50:25 +08:00
* security.cc (set_file_sd): Drop using FILE_OPEN_FOR_RECOVERY flag in
call to NtOpenFile. * exceptions.cc (open_stackdumpfile): Ditto in call to NtCreateFile. * fhandler.cc (fhandler_base::open): Ditto. Simplify setting create_options. * mount.cc (fs_info::update): Recognize offline storage. (fillout_mntent): Report UDF and offline storage. * mount.h (class fs_info): Add is_csc_cache status flag.
This commit is contained in:
parent
56a4d31a7f
commit
9d86c13dbb
@ -1,3 +1,15 @@
|
||||
2009-05-03 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* security.cc (set_file_sd): Drop using FILE_OPEN_FOR_RECOVERY flag in
|
||||
call to NtOpenFile.
|
||||
* exceptions.cc (open_stackdumpfile): Ditto in call to NtCreateFile.
|
||||
* fhandler.cc (fhandler_base::open): Ditto. Simplify setting
|
||||
create_options.
|
||||
|
||||
* mount.cc (fs_info::update): Recognize offline storage.
|
||||
(fillout_mntent): Report UDF and offline storage.
|
||||
* mount.h (class fs_info): Add is_csc_cache status flag.
|
||||
|
||||
2009-05-04 Christopher Faylor <me+cygwin@cgf.cx>
|
||||
|
||||
* fhandler_console.cc (fhandler_console::write_console): Eliminate
|
||||
|
@ -160,8 +160,7 @@ open_stackdumpfile ()
|
||||
status = NtCreateFile (&h, GENERIC_WRITE | SYNCHRONIZE, &attr, &io,
|
||||
NULL, FILE_ATTRIBUTE_NORMAL, 0, FILE_OVERWRITE_IF,
|
||||
FILE_SYNCHRONOUS_IO_NONALERT
|
||||
| FILE_OPEN_FOR_BACKUP_INTENT
|
||||
| FILE_OPEN_FOR_RECOVERY, NULL, 0);
|
||||
| FILE_OPEN_FOR_BACKUP_INTENT, NULL, 0);
|
||||
if (NT_SUCCESS (status))
|
||||
{
|
||||
if (!myself->cygstarted)
|
||||
|
@ -460,7 +460,7 @@ fhandler_base::open (int flags, mode_t mode)
|
||||
ULONG file_attributes = 0;
|
||||
ULONG shared = (get_major () == DEV_TAPE_MAJOR ? 0 : FILE_SHARE_VALID_FLAGS);
|
||||
ULONG create_disposition;
|
||||
ULONG create_options;
|
||||
ULONG create_options = FILE_OPEN_FOR_BACKUP_INTENT;
|
||||
SECURITY_ATTRIBUTES sa = sec_none;
|
||||
security_descriptor sd;
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
@ -477,38 +477,23 @@ fhandler_base::open (int flags, mode_t mode)
|
||||
{
|
||||
case query_read_control:
|
||||
access = READ_CONTROL;
|
||||
create_options = FILE_OPEN_FOR_BACKUP_INTENT;
|
||||
break;
|
||||
case query_read_attributes:
|
||||
access = READ_CONTROL | FILE_READ_ATTRIBUTES;
|
||||
create_options = FILE_OPEN_FOR_BACKUP_INTENT;
|
||||
break;
|
||||
case query_write_control:
|
||||
access = READ_CONTROL | WRITE_OWNER | WRITE_DAC | FILE_WRITE_ATTRIBUTES;
|
||||
create_options = FILE_OPEN_FOR_BACKUP_INTENT | FILE_OPEN_FOR_RECOVERY;
|
||||
break;
|
||||
case query_write_attributes:
|
||||
access = READ_CONTROL | FILE_WRITE_ATTRIBUTES;
|
||||
create_options = FILE_OPEN_FOR_BACKUP_INTENT | FILE_OPEN_FOR_RECOVERY;
|
||||
break;
|
||||
default:
|
||||
if ((flags & O_ACCMODE) == O_RDONLY)
|
||||
{
|
||||
access = GENERIC_READ;
|
||||
create_options = FILE_OPEN_FOR_BACKUP_INTENT;
|
||||
}
|
||||
access = GENERIC_READ;
|
||||
else if ((flags & O_ACCMODE) == O_WRONLY)
|
||||
{
|
||||
access = GENERIC_WRITE | READ_CONTROL | FILE_READ_ATTRIBUTES;
|
||||
create_options = FILE_OPEN_FOR_BACKUP_INTENT
|
||||
| FILE_OPEN_FOR_RECOVERY;
|
||||
}
|
||||
access = GENERIC_WRITE | READ_CONTROL | FILE_READ_ATTRIBUTES;
|
||||
else
|
||||
{
|
||||
access = GENERIC_READ | GENERIC_WRITE;
|
||||
create_options = FILE_OPEN_FOR_BACKUP_INTENT
|
||||
| FILE_OPEN_FOR_RECOVERY;
|
||||
}
|
||||
access = GENERIC_READ | GENERIC_WRITE;
|
||||
if (flags & O_SYNC)
|
||||
create_options |= FILE_WRITE_THROUGH;
|
||||
if (flags & O_DIRECT)
|
||||
|
@ -213,6 +213,8 @@ fs_info::update (PUNICODE_STRING upath, HANDLE in_vol)
|
||||
RtlInitCountedUnicodeString (&fsname, ffai_buf.ffai.FileSystemName,
|
||||
ffai_buf.ffai.FileSystemNameLength);
|
||||
is_fat (RtlEqualUnicodePathPrefix (&fsname, L"FAT", TRUE));
|
||||
RtlInitUnicodeString (&testname, L"CSC-CACHE");
|
||||
is_csc_cache (RtlEqualUnicodeString (&fsname, &testname, FALSE));
|
||||
RtlInitUnicodeString (&testname, L"NTFS");
|
||||
if (is_remote_drive ())
|
||||
{
|
||||
@ -1367,8 +1369,12 @@ fillout_mntent (const char *native_path, const char *posix_path, unsigned flags)
|
||||
strcpy (_my_tls.locals.mnt_type, (char *) "ntfs");
|
||||
else if (mntinfo.is_netapp ())
|
||||
strcpy (_my_tls.locals.mnt_type, (char *) "netapp");
|
||||
else if (mntinfo.is_udf ())
|
||||
strcpy (_my_tls.locals.mnt_type, (char *) "udf");
|
||||
else if (mntinfo.is_cdrom ())
|
||||
strcpy (_my_tls.locals.mnt_type, (char *) "iso9660");
|
||||
else if (mntinfo.is_csc_cache ())
|
||||
strcpy (_my_tls.locals.mnt_type, (char *) "csc-cache");
|
||||
else
|
||||
strcpy (_my_tls.locals.mnt_type, (char *) "unknown");
|
||||
|
||||
|
@ -32,6 +32,7 @@ class fs_info
|
||||
unsigned is_netapp : 1;
|
||||
unsigned is_cdrom : 1;
|
||||
unsigned is_udf : 1;
|
||||
unsigned is_csc_cache : 1;
|
||||
} status;
|
||||
ULONG sernum;
|
||||
public:
|
||||
@ -54,6 +55,7 @@ class fs_info
|
||||
IMPLEMENT_STATUS_FLAG (bool, is_netapp)
|
||||
IMPLEMENT_STATUS_FLAG (bool, is_cdrom)
|
||||
IMPLEMENT_STATUS_FLAG (bool, is_udf)
|
||||
IMPLEMENT_STATUS_FLAG (bool, is_csc_cache)
|
||||
ULONG serial_number () const { return sernum; }
|
||||
|
||||
bool update (PUNICODE_STRING, HANDLE) __attribute__ ((regparm (3)));
|
||||
|
@ -110,8 +110,7 @@ set_file_sd (HANDLE fh, path_conv &pc, security_descriptor &sd, bool is_chown)
|
||||
status = NtOpenFile (&fh, (is_chown ? WRITE_OWNER : 0) | WRITE_DAC,
|
||||
pc.get_object_attr (attr, sec_none_nih),
|
||||
&io, FILE_SHARE_VALID_FLAGS,
|
||||
FILE_OPEN_FOR_BACKUP_INTENT
|
||||
| FILE_OPEN_FOR_RECOVERY);
|
||||
FILE_OPEN_FOR_BACKUP_INTENT);
|
||||
if (!NT_SUCCESS (status))
|
||||
{
|
||||
fh = NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user