@@ -200,9 +200,7 @@ class FileWatcher {
200
200
kj::HashMap<int , kj::HashSet<kj::String>> filesWatched;
201
201
202
202
static kj::AutoCloseFd makeInotify () {
203
- int fd;
204
- KJ_SYSCALL (fd = inotify_init1 (IN_NONBLOCK | IN_CLOEXEC));
205
- return kj::AutoCloseFd (fd);
203
+ return KJ_SYSCALL_FD (inotify_init1 (IN_NONBLOCK | IN_CLOEXEC));
206
204
}
207
205
};
208
206
@@ -233,17 +231,13 @@ class FileWatcher {
233
231
KJ_IF_SOME (fd, f.getFd ()) {
234
232
// We need to duplicate the FD because the original will probably be closed later and
235
233
// closing the FD unregisters it from kqueue.
236
- int duped;
237
- KJ_SYSCALL (duped = dup (fd));
238
- watchFd (kj::AutoCloseFd (duped));
234
+ watchFd (KJ_SYSCALL_FD (dup (fd)));
239
235
return ;
240
236
}
241
237
}
242
238
243
239
// No existing file, open from disk.
244
- int fd;
245
- KJ_SYSCALL (fd = open (path.toNativeString (true ).cStr (), O_RDONLY));
246
- watchFd (kj::AutoCloseFd (fd));
240
+ watchFd (KJ_SYSCALL_FD (open (path.toNativeString (true ).cStr (), O_RDONLY)));
247
241
}
248
242
249
243
kj::Promise<void > onChange () {
@@ -275,9 +269,7 @@ class FileWatcher {
275
269
kj::Vector<kj::AutoCloseFd> filesWatched;
276
270
277
271
static kj::AutoCloseFd makeKqueue () {
278
- int fd_;
279
- KJ_SYSCALL (fd_ = kqueue ());
280
- auto fd = kj::AutoCloseFd (fd_);
272
+ auto fd = KJ_SYSCALL_FD (kqueue ());
281
273
KJ_SYSCALL (fcntl (fd, F_SETFD, FD_CLOEXEC));
282
274
return kj::mv (fd);
283
275
}
0 commit comments