We need to properly initialize all error structs before use and free
them after use.
Also, there's no point in flushing stdout if we output a \n anyway...
s->notify_access = NOTIFY_MAIN;
if (s->type == SERVICE_DBUS || s->bus_name) {
s->notify_access = NOTIFY_MAIN;
if (s->type == SERVICE_DBUS || s->bus_name) {
- r = unit_add_two_dependencies_by_name(u, UNIT_AFTER, UNIT_REQUIRES,
- SPECIAL_DBUS_SOCKET, NULL, true);
+ r = unit_add_two_dependencies_by_name(u, UNIT_AFTER, UNIT_REQUIRES, SPECIAL_DBUS_SOCKET, NULL, true);
}
static int cat(sd_bus *bus, char **args) {
}
static int cat(sd_bus *bus, char **args) {
+ _cleanup_free_ char *unit = NULL, *n = NULL;
- _cleanup_free_ char *unit = NULL, *n = NULL;
-
assert(bus);
assert(args);
pager_open_if_enabled();
STRV_FOREACH(name, args+1) {
assert(bus);
assert(args);
pager_open_if_enabled();
STRV_FOREACH(name, args+1) {
- _cleanup_free_ char *fragment_path = NULL;
+ _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_strv_free_ char **dropin_paths = NULL;
_cleanup_strv_free_ char **dropin_paths = NULL;
+ _cleanup_free_ char *fragment_path = NULL;
char **path;
n = unit_name_mangle(*name);
char **path;
n = unit_name_mangle(*name);
if (!isempty(fragment_path)) {
fprintf(stdout, "# %s\n", fragment_path);
fflush(stdout);
if (!isempty(fragment_path)) {
fprintf(stdout, "# %s\n", fragment_path);
fflush(stdout);
r = sendfile_full(STDOUT_FILENO, fragment_path);
if (r < 0) {
log_warning("Failed to cat %s: %s", fragment_path, strerror(-r));
r = sendfile_full(STDOUT_FILENO, fragment_path);
if (r < 0) {
log_warning("Failed to cat %s: %s", fragment_path, strerror(-r));
isempty(fragment_path) && path == dropin_paths ? "" : "\n",
*path);
fflush(stdout);
isempty(fragment_path) && path == dropin_paths ? "" : "\n",
*path);
fflush(stdout);
r = sendfile_full(STDOUT_FILENO, *path);
if (r < 0) {
log_warning("Failed to cat %s: %s", *path, strerror(-r));
r = sendfile_full(STDOUT_FILENO, *path);
if (r < 0) {
log_warning("Failed to cat %s: %s", *path, strerror(-r));