journald-wall.c revision 99f710dde855f7ecb699ddac6ad77923c1f6bc85
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering This file is part of systemd.
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering Copyright 2014 Sebastian Thorarensen
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering systemd is free software; you can redistribute it and/or modify it
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering under the terms of the GNU Lesser General Public License as published by
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering (at your option) any later version.
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering systemd is distributed in the hope that it will be useful, but
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering Lesser General Public License for more details.
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering You should have received a copy of the GNU Lesser General Public License
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
25300b5a1fcf54674a69d0f4ab08925be00b0227Lennart Poettering _cleanup_free_ char *ident_buf = NULL, *l_buf = NULL;
3ffd4af22052963e7a29431721ee204e634bea75Lennart Poettering const char *l;
3ffd4af22052963e7a29431721ee204e634bea75Lennart Poettering if (LOG_PRI(priority) > s->max_level_wall)
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering get_process_comm(ucred->pid, &ident_buf);
160e3793adf2da2bd9ae3fe6b8881bb937e6e71bLennart Poettering if (asprintf(&l_buf, "%s["PID_FMT"]: %s", strempty(identifier), ucred->pid, message) < 0) {
160e3793adf2da2bd9ae3fe6b8881bb937e6e71bLennart Poettering l = l_buf = strjoin(identifier, ": ", message, NULL);
160e3793adf2da2bd9ae3fe6b8881bb937e6e71bLennart Poettering r = utmp_wall(l, "systemd-journald", NULL, NULL, NULL);
160e3793adf2da2bd9ae3fe6b8881bb937e6e71bLennart Poettering log_debug_errno(r, "Failed to send wall message: %m");