X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fpath.c;h=f54c77f6c3980804ececcf23a1286221adf37a7c;hb=07a60cc13c48c5f79616b07aad2808bfe809de22;hp=51e8d1dbcc7a92c67f909df056ac1872e9c9799d;hpb=718db96199eb307751264e4163555662c9a389fa;p=elogind.git diff --git a/src/core/path.c b/src/core/path.c index 51e8d1dbc..f54c77f6c 100644 --- a/src/core/path.c +++ b/src/core/path.c @@ -71,7 +71,7 @@ int path_spec_watch(PathSpec *s, sd_event_io_handler_t handler) { goto fail; } - r = sd_event_add_io(s->unit->manager->event, s->inotify_fd, EPOLLIN, handler, s, &s->event_source); + r = sd_event_add_io(s->unit->manager->event, &s->event_source, s->inotify_fd, EPOLLIN, handler, s); if (r < 0) goto fail; @@ -99,7 +99,8 @@ int path_spec_watch(PathSpec *s, sd_event_io_handler_t handler) { break; } - log_warning("Failed to add watch on %s: %m", s->path); + log_warning("Failed to add watch on %s: %s", s->path, + errno == ENOSPC ? "too many watches" : strerror(-r)); r = -errno; if (cut) *cut = tmp; @@ -152,11 +153,7 @@ void path_spec_unwatch(PathSpec *s) { assert(s); s->event_source = sd_event_source_unref(s->event_source); - - if (s->inotify_fd >= 0) { - close_nointr_nofail(s->inotify_fd); - s->inotify_fd = -1; - } + s->inotify_fd = safe_close(s->inotify_fd); } int path_spec_fd_event(PathSpec *s, uint32_t revents) { @@ -761,16 +758,16 @@ DEFINE_STRING_TABLE_LOOKUP(path_state, PathState); static const char* const path_type_table[_PATH_TYPE_MAX] = { [PATH_EXISTS] = "PathExists", [PATH_EXISTS_GLOB] = "PathExistsGlob", + [PATH_DIRECTORY_NOT_EMPTY] = "DirectoryNotEmpty", [PATH_CHANGED] = "PathChanged", [PATH_MODIFIED] = "PathModified", - [PATH_DIRECTORY_NOT_EMPTY] = "DirectoryNotEmpty" }; DEFINE_STRING_TABLE_LOOKUP(path_type, PathType); static const char* const path_result_table[_PATH_RESULT_MAX] = { [PATH_SUCCESS] = "success", - [PATH_FAILURE_RESOURCES] = "resources" + [PATH_FAILURE_RESOURCES] = "resources", }; DEFINE_STRING_TABLE_LOOKUP(path_result, PathResult); @@ -805,6 +802,5 @@ const UnitVTable path_vtable = { .reset_failed = path_reset_failed, .bus_interface = "org.freedesktop.systemd1.Path", - .bus_vtable = bus_path_vtable, - .bus_changing_properties = bus_path_changing_properties + .bus_vtable = bus_path_vtable };