* ply should do mkdir before writing pid file
+* ConditionDirectoryNotEmpty= needs to be documented
+
Features:
* teach dbus to activate all services it finds in /etc/systemd/services/org-*.service
Condition* condition_new(ConditionType type, const char *parameter, bool trigger, bool negate) {
Condition *c;
- c = new0(Condition, 1);
+ if (!(c = new0(Condition, 1)))
+ return NULL;
+
c->type = type;
c->trigger = trigger;
c->negate = negate;
if (!e)
goto oom;
- if (!(reply = dbus_message_new_method_return(message)))
+ if (!(reply = dbus_message_new_method_return(message))) {
+ strv_free(e);
goto oom;
+ }
strv_free(m->environment);
m->environment = e;
goto oom;
}
- free(path);
-
if (reply) {
if (!dbus_connection_send(connection, reply, NULL))
goto oom;
dbus_message_unref(reply);
}
+ free(path);
+
return DBUS_HANDLER_RESULT_HANDLED;
oom:
goto oom;
}
- free(path);
-
if (reply) {
if (!dbus_connection_send(connection, reply, NULL))
goto oom;
dbus_message_unref(reply);
}
+ free(path);
+
return DBUS_HANDLER_RESULT_HANDLED;
oom:
}
if (epoll_ctl(m->epoll_fd, EPOLL_CTL_ADD, w->fd, &ev) < 0) {
- free(w);
close_nointr_nofail(w->fd);
+ free(w);
return FALSE;
}
if (dbus_timeout_get_enabled(w->data.bus_timeout)) {
timespec_store(&its.it_value, dbus_timeout_get_interval(w->data.bus_timeout) * USEC_PER_MSEC);
- its.it_interval = its.it_interval;
+ its.it_interval = its.it_value;
}
if (timerfd_settime(w->fd, 0, &its, NULL) < 0)
if (!(w = new0(Watch, 1)))
return FALSE;
- if (!(w->fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK|TFD_CLOEXEC)) < 0)
+ if ((w->fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK|TFD_CLOEXEC)) < 0)
goto fail;
w->type = WATCH_DBUS_TIMEOUT;
char **i;
/* Final step, initialize any manually set supplementary groups */
- ngroups_max = (int) sysconf(_SC_NGROUPS_MAX);
+ assert_se((ngroups_max = (int) sysconf(_SC_NGROUPS_MAX)) > 0);
if (!(gids = new(gid_t, ngroups_max)))
return -ENOMEM;
log_debug("Serializing state to %s", path);
free(path);
- if (!(f = fdopen(fd, "w+")) < 0)
+ if (!(f = fdopen(fd, "w+")))
return -errno;
*_f = f;
}
f = fopen(fn, "re");
- free(fn);
if (!f) {
- if (errno == ENOENT)
+ if (errno == ENOENT) {
+ free(fn);
continue;
+ }
log_error("Failed to open %s: %m", fn);
+ free(fn);
r = EXIT_FAILURE;
continue;
}
+ free(fn);
+
for (;;) {
char line[LINE_MAX], *l, *t;
wait_for_exit = true;
set_free(pid_set);
+ pid_set = NULL;
}
}
FILE *pack = NULL;
char line[LINE_MAX];
int r = 0;
- char *pack_fn = NULL, c;
+ char *pack_fn = NULL;
+ int c;
bool on_ssd, ready = false;
int prio;
int inotify_fd = -1;
/* FIXME: Maybe we should compare the name here lexicographically? */
- if (!(r = unit_add_dependency(UNIT(s), d, UNIT(t), true)) < 0)
+ if ((r = unit_add_dependency(UNIT(s), d, UNIT(t), true)) < 0)
return r;
}
else
continue;
- if (!(r = unit_add_dependency(UNIT(s), d, UNIT(t), true)) < 0)
+ if ((r = unit_add_dependency(UNIT(s), d, UNIT(t), true)) < 0)
return r;
}
wait_for_exit = true;
set_free(pid_set);
+ pid_set = NULL;
}
}
if ((pollfd[i].fd = timerfd_create(CLOCK_REALTIME, TFD_NONBLOCK|TFD_CLOEXEC)) < 0) {
log_error("timerfd_create(): %m");
- failed = false;
+ failed = true;
}
}
wait_for_exit = true;
set_free(pid_set);
+ pid_set = NULL;
}
}
case SOCKET_START_PRE:
log_warning("%s starting timed out. Terminating.", u->meta.id);
socket_enter_signal(s, SOCKET_FINAL_SIGTERM, false);
+ break;
case SOCKET_START_POST:
log_warning("%s starting timed out. Stopping.", u->meta.id);
return r;
fail:
- for (k--, l--; k >= r; k--, l--)
+ for (k--; k >= r; k--)
free(*k);
+ free(r);
+
return NULL;
}
return r;
fail:
+ va_end(ap);
+
for (k--; k >= r; k--)
free(*k);
wait_for_exit = true;
set_free(pid_set);
+ pid_set = NULL;
}
}
return r;
fail:
- j--;
- while (j >= r)
+ for (j--; j >= r; j--)
free(*j);
free(r);
free(p);
if (!value) {
- free(p);
free(name);
return NULL;
}