|
@@ -124,13 +124,19 @@ ErrorOr<int> InodeWatcher::register_inode(Inode& inode, unsigned event_mask)
|
|
auto description = TRY(WatchDescription::create(wd, inode, event_mask));
|
|
auto description = TRY(WatchDescription::create(wd, inode, event_mask));
|
|
|
|
|
|
TRY(m_inode_to_watches.try_set(inode.identifier(), description.ptr()));
|
|
TRY(m_inode_to_watches.try_set(inode.identifier(), description.ptr()));
|
|
- auto result = m_wd_to_watches.try_set(wd, move(description));
|
|
|
|
- if (result.is_error()) {
|
|
|
|
|
|
+ auto set_result = m_wd_to_watches.try_set(wd, move(description));
|
|
|
|
+ if (set_result.is_error()) {
|
|
m_inode_to_watches.remove(inode.identifier());
|
|
m_inode_to_watches.remove(inode.identifier());
|
|
- return result.release_error();
|
|
|
|
|
|
+ return set_result.release_error();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ auto register_result = inode.register_watcher({}, *this);
|
|
|
|
+ if (register_result.is_error()) {
|
|
|
|
+ m_inode_to_watches.remove(inode.identifier());
|
|
|
|
+ m_wd_to_watches.remove(wd);
|
|
|
|
+ return register_result.release_error();
|
|
}
|
|
}
|
|
|
|
|
|
- inode.register_watcher({}, *this);
|
|
|
|
return wd;
|
|
return wd;
|
|
}
|
|
}
|
|
|
|
|