/*-*- Mode: C; c-basic-offset: 8 -*-*/
+/***
+ This file is part of systemd.
+
+ Copyright 2010 Lennart Poettering
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
#include <errno.h>
#include <signal.h>
ServiceExecCommand c;
Service *s = SERVICE(u);
- char *prefix2;
+ const char *prefix2;
+ char *p2;
assert(s);
- prefix2 = strappend(prefix, "\t");
- if (!prefix2)
- prefix2 = "";
+ p2 = strappend(prefix, "\t");
+ prefix2 = p2 ? p2 : prefix;
fprintf(f,
"%sService State: %s\n",
exec_command_dump_list(s->exec_command[c], f, prefix2);
}
- free(prefix2);
+ free(p2);
}
static int service_load_pid_file(Service *s) {
static int service_notify_sockets(Service *s) {
Iterator i;
Set *set;
- Socket *socket;
+ Socket *sock;
int r;
assert(s);
if ((r = service_get_sockets(s, &set)) < 0)
return r;
- SET_FOREACH(socket, set, i)
- socket_notify_service_dead(socket);
+ SET_FOREACH(sock, set, i)
+ socket_notify_service_dead(sock);
set_free(set);
int *rfds = NULL;
unsigned rn_fds = 0;
Set *set;
- Socket *socket;
+ Socket *sock;
assert(s);
assert(fds);
if ((r = service_get_sockets(s, &set)) < 0)
return r;
- SET_FOREACH(socket, set, i) {
+ SET_FOREACH(sock, set, i) {
int *cfds;
unsigned cn_fds;
- if ((r = socket_collect_fds(socket, &cfds, &cn_fds)) < 0)
+ if ((r = socket_collect_fds(sock, &cfds, &cn_fds)) < 0)
goto fail;
if (!cfds)