* fhandler_procsys.cc (fhandler_procsys::exists): Rearrange to handle
dangling symlinks correctly. Fix comments. (fhandler_procsys::fill_filebuf): Remove useless comment.
This commit is contained in:
parent
b88e4203a9
commit
28e19bafa0
|
@ -1,3 +1,9 @@
|
||||||
|
2010-09-10 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* fhandler_procsys.cc (fhandler_procsys::exists): Rearrange to handle
|
||||||
|
dangling symlinks correctly. Fix comments.
|
||||||
|
(fhandler_procsys::fill_filebuf): Remove useless comment.
|
||||||
|
|
||||||
2010-09-08 Corinna Vinschen <corinna@vinschen.de>
|
2010-09-08 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* fhandler_procsys.cc (fhandler_procsys::open): Simplify by just
|
* fhandler_procsys.cc (fhandler_procsys::open): Simplify by just
|
||||||
|
|
|
@ -52,6 +52,7 @@ fhandler_procsys::exists (struct __stat64 *buf)
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
HANDLE h;
|
HANDLE h;
|
||||||
FILE_BASIC_INFORMATION fbi;
|
FILE_BASIC_INFORMATION fbi;
|
||||||
|
/* Default device type is character device. */
|
||||||
virtual_ftype_t file_type = virt_chr;
|
virtual_ftype_t file_type = virt_chr;
|
||||||
|
|
||||||
if (strlen (get_name ()) == procsys_len)
|
if (strlen (get_name ()) == procsys_len)
|
||||||
|
@ -61,16 +62,17 @@ fhandler_procsys::exists (struct __stat64 *buf)
|
||||||
InitializeObjectAttributes (&attr, &path, OBJ_CASE_INSENSITIVE, NULL, NULL);
|
InitializeObjectAttributes (&attr, &path, OBJ_CASE_INSENSITIVE, NULL, NULL);
|
||||||
status = NtOpenFile (&h, READ_CONTROL | FILE_READ_ATTRIBUTES, &attr, &io,
|
status = NtOpenFile (&h, READ_CONTROL | FILE_READ_ATTRIBUTES, &attr, &io,
|
||||||
FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT);
|
FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT);
|
||||||
if (status == STATUS_OBJECT_PATH_NOT_FOUND)
|
/* If no media is found, or we get this dreaded sharing violation, let
|
||||||
return virt_none;
|
the caller immediately try again as normal file. */
|
||||||
/* If the name isn't found, or we get this dreaded sharing violation, let
|
if (status == STATUS_NO_MEDIA_IN_DEVICE
|
||||||
the caller try again as normal file. */
|
|
||||||
if (status == STATUS_OBJECT_NAME_NOT_FOUND
|
|
||||||
|| status == STATUS_NO_MEDIA_IN_DEVICE
|
|
||||||
|| status == STATUS_SHARING_VIOLATION)
|
|| status == STATUS_SHARING_VIOLATION)
|
||||||
return virt_fsfile; /* Just try again as normal file. */
|
return virt_fsfile; /* Just try again as normal file. */
|
||||||
|
/* If file or path can't be found, let caller try again as normal file. */
|
||||||
|
if (status == STATUS_OBJECT_PATH_NOT_FOUND
|
||||||
|
|| status == STATUS_OBJECT_NAME_NOT_FOUND)
|
||||||
|
file_type = virt_fsfile;
|
||||||
/* Check for pipe errors, which make a good hint... */
|
/* Check for pipe errors, which make a good hint... */
|
||||||
if (status >= STATUS_PIPE_NOT_AVAILABLE && status <= STATUS_PIPE_BUSY)
|
else if (status >= STATUS_PIPE_NOT_AVAILABLE && status <= STATUS_PIPE_BUSY)
|
||||||
file_type = virt_pipe;
|
file_type = virt_pipe;
|
||||||
else if (status == STATUS_ACCESS_DENIED)
|
else if (status == STATUS_ACCESS_DENIED)
|
||||||
{
|
{
|
||||||
|
@ -134,7 +136,7 @@ fhandler_procsys::exists (struct __stat64 *buf)
|
||||||
}
|
}
|
||||||
else if (status == STATUS_ACCESS_DENIED)
|
else if (status == STATUS_ACCESS_DENIED)
|
||||||
return virt_directory;
|
return virt_directory;
|
||||||
/* Give up. Just treat as character device. */
|
/* That's it. Return type we found above. */
|
||||||
return file_type;
|
return file_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +154,6 @@ fhandler_procsys::fhandler_procsys ():
|
||||||
bool
|
bool
|
||||||
fhandler_procsys::fill_filebuf ()
|
fhandler_procsys::fill_filebuf ()
|
||||||
{
|
{
|
||||||
/* The NT device namespace is ASCII only. */
|
|
||||||
char *fnamep;
|
char *fnamep;
|
||||||
UNICODE_STRING path, target;
|
UNICODE_STRING path, target;
|
||||||
OBJECT_ATTRIBUTES attr;
|
OBJECT_ATTRIBUTES attr;
|
||||||
|
|
Loading…
Reference in New Issue