From e3b59eac246985365703eae2d6313b941869763c Mon Sep 17 00:00:00 2001 From: Ulrich Czekalla Date: Wed, 16 Mar 2005 19:48:42 +0000 Subject: [PATCH] Don't mark a file as readonly if it has any write bit set. --- dlls/ntdll/directory.c | 2 +- dlls/ntdll/file.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c index 47eae4363ef..df7cc74061a 100644 --- a/dlls/ntdll/directory.c +++ b/dlls/ntdll/directory.c @@ -628,7 +628,7 @@ static FILE_BOTH_DIR_INFORMATION *append_entry( void *info_ptr, ULONG *pos, ULON info->FileAttributes = FILE_ATTRIBUTE_ARCHIVE; } - if (!(st.st_mode & S_IWUSR)) + if (!(st.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH))) info->FileAttributes |= FILE_ATTRIBUTE_READONLY; if (!show_dot_files && long_name[0] == '.' && long_name[1] && (long_name[1] != '.' || long_name[2])) diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index 777e038fb65..ca4b80974b0 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -966,7 +966,8 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io, { if (S_ISDIR(st.st_mode)) info->FileAttributes = FILE_ATTRIBUTE_DIRECTORY; else info->FileAttributes = FILE_ATTRIBUTE_ARCHIVE; - if (!(st.st_mode & S_IWUSR)) info->FileAttributes |= FILE_ATTRIBUTE_READONLY; + if (!(st.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH))) + info->FileAttributes |= FILE_ATTRIBUTE_READONLY; RtlSecondsSince1970ToTime( st.st_mtime, &info->CreationTime); RtlSecondsSince1970ToTime( st.st_mtime, &info->LastWriteTime); RtlSecondsSince1970ToTime( st.st_ctime, &info->ChangeTime); @@ -1053,7 +1054,7 @@ NTSTATUS WINAPI NtQueryInformationFile( HANDLE hFile, PIO_STATUS_BLOCK io, info->StandardInformation.NumberOfLinks = st.st_nlink; info->StandardInformation.DeletePending = FALSE; /* FIXME */ } - if (!(st.st_mode & S_IWUSR)) + if (!(st.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH))) info->BasicInformation.FileAttributes |= FILE_ATTRIBUTE_READONLY; RtlSecondsSince1970ToTime( st.st_mtime, &info->BasicInformation.CreationTime); RtlSecondsSince1970ToTime( st.st_mtime, &info->BasicInformation.LastWriteTime); @@ -1249,7 +1250,8 @@ NTSTATUS WINAPI NtQueryFullAttributesFile( const OBJECT_ATTRIBUTES *attr, info->AllocationSize.QuadPart = (ULONGLONG)st.st_blocks * 512; info->EndOfFile.QuadPart = st.st_size; } - if (!(st.st_mode & S_IWUSR)) info->FileAttributes |= FILE_ATTRIBUTE_READONLY; + if (!(st.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH))) + info->FileAttributes |= FILE_ATTRIBUTE_READONLY; RtlSecondsSince1970ToTime( st.st_mtime, &info->CreationTime ); RtlSecondsSince1970ToTime( st.st_mtime, &info->LastWriteTime ); RtlSecondsSince1970ToTime( st.st_ctime, &info->ChangeTime ); -- 2.11.4.GIT