X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fmanager.c;h=e59649464608b7ec5d9837608af8e266705b746d;hb=498e87d6b7ef025fef2e089931f355b5cd3c7dad;hp=2eab5530166e83b32f1cd34d9413705e0634deca;hpb=56dacdbc1ca95cef8bf8c97c0d7af761a71eaab3;p=elogind.git diff --git a/src/core/manager.c b/src/core/manager.c index 2eab55301..e59649464 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -678,6 +678,8 @@ static int manager_setup_notify(Manager *m) { if (!m->notify_socket) return log_oom(); + (void) mkdir_parents_label(m->notify_socket, 0755); + strncpy(sa.un.sun_path, m->notify_socket, sizeof(sa.un.sun_path)-1); r = bind(fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(sa.un.sun_path)); if (r < 0) { @@ -2066,6 +2068,7 @@ void manager_send_unit_audit(Manager *m, Unit *u, int type, bool success) { #ifdef HAVE_AUDIT _cleanup_free_ char *p = NULL; + const char *msg; int audit_fd; audit_fd = get_audit_fd(); @@ -2085,17 +2088,18 @@ void manager_send_unit_audit(Manager *m, Unit *u, int type, bool success) { p = unit_name_to_prefix_and_instance(u->id); if (!p) { - log_error_unit(u->id, - "Failed to allocate unit name for audit message: %s", strerror(ENOMEM)); + log_oom(); return; } - if (audit_log_user_comm_message(audit_fd, type, "", p, NULL, NULL, NULL, success) < 0) { - if (errno == EPERM) { + msg = strappenda("unit=", p); + + if (audit_log_user_comm_message(audit_fd, type, msg, "systemd", NULL, NULL, NULL, success) < 0) { + if (errno == EPERM) /* We aren't allowed to send audit messages? * Then let's not retry again. */ close_audit_fd(); - } else + else log_warning("Failed to send audit message: %m"); } #endif