mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 09:39:39 +00:00
LibCore: Remove monitored file data before invoking system calls
The monitored files can be internally removed by inotify. If we then try to explicitly remove them, the inotify_rm_watch call will fail. We do this when the file is deleted and we receive an IN_DELETE event. This ensures we clean up the monitored files.
This commit is contained in:
parent
61419cf717
commit
abc462999e
Notes:
github-actions[bot]
2024-08-25 07:49:10 +00:00
Author: https://github.com/trflynn89
Commit: abc462999e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1182
1 changed files with 3 additions and 3 deletions
|
@ -164,12 +164,12 @@ ErrorOr<bool> FileWatcherBase::remove_watch(ByteString path)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (::inotify_rm_watch(m_watcher_fd, it->value) < 0)
|
|
||||||
return Error::from_errno(errno);
|
|
||||||
|
|
||||||
m_path_to_wd.remove(it);
|
m_path_to_wd.remove(it);
|
||||||
m_wd_to_path.remove(it->value);
|
m_wd_to_path.remove(it->value);
|
||||||
|
|
||||||
|
if (::inotify_rm_watch(m_watcher_fd, it->value) < 0)
|
||||||
|
return Error::from_errno(errno);
|
||||||
|
|
||||||
dbgln_if(FILE_WATCHER_DEBUG, "remove_watch: stopped watching path '{}' on InodeWatcher {}", path, m_watcher_fd);
|
dbgln_if(FILE_WATCHER_DEBUG, "remove_watch: stopped watching path '{}' on InodeWatcher {}", path, m_watcher_fd);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue