* path.cc (etc::dir_changed): Revert muto changes since function is
called under lock condition anyway.
This commit is contained in:
parent
68e41cfcf4
commit
bc025aada5
@ -1,3 +1,8 @@
|
|||||||
|
2012-07-31 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* path.cc (etc::dir_changed): Revert muto changes since function is
|
||||||
|
called under lock condition anyway.
|
||||||
|
|
||||||
2012-07-31 Corinna Vinschen <corinna@vinschen.de>
|
2012-07-31 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* path.cc (etc::dir_changed): Change `io' to a static NO_COPY
|
* path.cc (etc::dir_changed): Change `io' to a static NO_COPY
|
||||||
|
@ -4311,12 +4311,11 @@ etc::test_file_change (int n)
|
|||||||
bool
|
bool
|
||||||
etc::dir_changed (int n)
|
etc::dir_changed (int n)
|
||||||
{
|
{
|
||||||
static muto lock NO_COPY;
|
|
||||||
static HANDLE changed_h NO_COPY;
|
|
||||||
/* io MUST be static because NtNotifyChangeDirectoryFile works asynchronously.
|
/* io MUST be static because NtNotifyChangeDirectoryFile works asynchronously.
|
||||||
It may write into io after the function has left, which may result in all
|
It may write into io after the function has left, which may result in all
|
||||||
sorts of stack corruption. */
|
sorts of stack corruption. */
|
||||||
static IO_STATUS_BLOCK io NO_COPY;
|
static IO_STATUS_BLOCK io NO_COPY;
|
||||||
|
static HANDLE changed_h NO_COPY;
|
||||||
|
|
||||||
if (!change_possible[n])
|
if (!change_possible[n])
|
||||||
{
|
{
|
||||||
@ -4326,15 +4325,10 @@ etc::dir_changed (int n)
|
|||||||
{
|
{
|
||||||
OBJECT_ATTRIBUTES attr;
|
OBJECT_ATTRIBUTES attr;
|
||||||
|
|
||||||
lock.init ("etc_dir_changed_lock")->acquire ();
|
|
||||||
if (!changed_h)
|
|
||||||
{
|
|
||||||
path_conv dir ("/etc");
|
path_conv dir ("/etc");
|
||||||
status = NtOpenFile (&changed_h,
|
status = NtOpenFile (&changed_h, SYNCHRONIZE | FILE_LIST_DIRECTORY,
|
||||||
SYNCHRONIZE | FILE_LIST_DIRECTORY,
|
dir.get_object_attr (attr, sec_none_nih), &io,
|
||||||
dir.get_object_attr (attr, sec_none_nih),
|
FILE_SHARE_VALID_FLAGS, FILE_DIRECTORY_FILE);
|
||||||
&io, FILE_SHARE_VALID_FLAGS,
|
|
||||||
FILE_DIRECTORY_FILE);
|
|
||||||
if (!NT_SUCCESS (status))
|
if (!NT_SUCCESS (status))
|
||||||
{
|
{
|
||||||
#ifdef DEBUGGING
|
#ifdef DEBUGGING
|
||||||
@ -4353,8 +4347,8 @@ etc::dir_changed (int n)
|
|||||||
if (!NT_SUCCESS (status))
|
if (!NT_SUCCESS (status))
|
||||||
{
|
{
|
||||||
#ifdef DEBUGGING
|
#ifdef DEBUGGING
|
||||||
system_printf ("NtNotifyChangeDirectoryFile (1) failed, "
|
system_printf ("NtNotifyChangeDirectoryFile (1) failed, %p",
|
||||||
"%p", status);
|
status);
|
||||||
#endif
|
#endif
|
||||||
NtClose (changed_h);
|
NtClose (changed_h);
|
||||||
changed_h = INVALID_HANDLE_VALUE;
|
changed_h = INVALID_HANDLE_VALUE;
|
||||||
@ -4362,8 +4356,6 @@ etc::dir_changed (int n)
|
|||||||
}
|
}
|
||||||
memset (change_possible, true, sizeof (change_possible));
|
memset (change_possible, true, sizeof (change_possible));
|
||||||
}
|
}
|
||||||
lock.release ();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (changed_h == INVALID_HANDLE_VALUE)
|
if (changed_h == INVALID_HANDLE_VALUE)
|
||||||
change_possible[n] = true;
|
change_possible[n] = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user