|
@@ -123,8 +123,12 @@ ErrorOr<int> InodeWatcher::register_inode(Inode& inode, unsigned event_mask)
|
|
|
|
|
|
auto description = TRY(WatchDescription::create(wd, inode, event_mask));
|
|
|
|
|
|
- m_inode_to_watches.set(inode.identifier(), description.ptr());
|
|
|
- m_wd_to_watches.set(wd, move(description));
|
|
|
+ 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()) {
|
|
|
+ m_inode_to_watches.remove(inode.identifier());
|
|
|
+ return result.release_error();
|
|
|
+ }
|
|
|
|
|
|
inode.register_watcher({}, *this);
|
|
|
return wd;
|