id_len = max_id_len;
for (u = unit_infos; u < unit_infos + c; u++) {
- char _cleanup_free_ *e = NULL;
+ _cleanup_free_ char *e = NULL;
const char *on_loaded, *off_loaded, *on = "";
const char *on_active, *off_active, *off = "";
{
const char *interface = "org.freedesktop.systemd1.Unit",
*triggers_property = "Triggers";
- DBusMessage _cleanup_dbus_message_unref_ *reply = NULL;
+ _cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
DBusMessageIter iter, sub;
int r;
{
const char *interface = "org.freedesktop.systemd1.Socket",
*listen_property = "Listen";
- DBusMessage _cleanup_dbus_message_unref_ *reply = NULL;
+ _cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
DBusMessageIter iter, sub;
int r;
for (u = unit_infos; u < unit_infos + cu; u++) {
const char *dot;
- char _cleanup_strv_free_ **listen = NULL, **triggered = NULL;
+ _cleanup_strv_free_ char **listen = NULL, **triggered = NULL;
unsigned c = 0, i;
if (!output_show_unit(u))
printf("%-*s %-*s\n", id_cols, "UNIT FILE", state_cols, "STATE");
for (u = units; u < units + c; u++) {
- char _cleanup_free_ *e = NULL;
+ _cleanup_free_ char *e = NULL;
const char *on, *off;
const char *id;
}
static int list_dependencies_one(DBusConnection *bus, const char *name, int level, char **units, unsigned int branches) {
- char _cleanup_strv_free_ **deps = NULL, **u;
+ _cleanup_strv_free_ char **deps = NULL, **u;
char **c;
int r = 0;
l3, "STATE");
for (i = 0, j = jobs; i < n; i++, j++) {
- char _cleanup_free_ *e = NULL;
+ _cleanup_free_ char *e = NULL;
if (streq(j->state, "running")) {
on = ansi_highlight(true);
} WaitData;
static DBusHandlerResult wait_filter(DBusConnection *connection, DBusMessage *message, void *data) {
- DBusError _cleanup_dbus_error_free_ error;
+ _cleanup_dbus_error_free_ DBusError error;
WaitData *d = data;
dbus_error_init(&error);
*load_state_property = "LoadState",
*triggered_by_property = "TriggeredBy",
*state;
- char _cleanup_free_ *unit_path = NULL, *n = NULL;
+ _cleanup_free_ char *unit_path = NULL, *n = NULL;
bool print_warning_label = true;
int r;
int r, ret = 0;
const char *method, *mode, *one_name;
- Set _cleanup_set_free_free_ *s = NULL;
- DBusError _cleanup_dbus_error_free_ error;
+ _cleanup_set_free_free_ Set *s = NULL;
+ _cleanup_dbus_error_free_ DBusError error;
char **name;
dbus_error_init(&error);
if (startswith(*p, "man:")) {
size_t k;
char *e = NULL;
- char _cleanup_free_ *page = NULL, *section = NULL;
+ _cleanup_free_ char *page = NULL, *section = NULL;
const char *args[4] = { "man", NULL, NULL, NULL };
pid_t pid;
if (exec_status_info_deserialize(&sub, &info) >= 0) {
char timestamp1[FORMAT_TIMESTAMP_MAX], timestamp2[FORMAT_TIMESTAMP_MAX];
- char _cleanup_free_ *t;
+ _cleanup_free_ char *t;
t = strv_join(info.argv, " ");
}
static int show_one(const char *verb, DBusConnection *bus, const char *path, bool show_properties, bool *new_line) {
- DBusMessage _cleanup_free_ *reply = NULL;
+ _cleanup_free_ DBusMessage *reply = NULL;
const char *interface = "";
int r;
DBusMessageIter iter, sub, sub2, sub3;
static int show_one_by_pid(const char *verb, DBusConnection *bus, uint32_t pid, bool *new_line) {
_cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
const char *path = NULL;
- DBusError _cleanup_dbus_error_free_ error;
+ _cleanup_dbus_error_free_ DBusError error;
int r;
dbus_error_init(&error);
qsort(unit_infos, c, sizeof(struct unit_info), compare_unit_info);
for (u = unit_infos; u < unit_infos + c; u++) {
- char _cleanup_free_ *p = NULL;
+ _cleanup_free_ char *p = NULL;
if (!output_show_unit(u))
continue;
r = 0;
for (f = 1; args[f]; f++) {
const char *name;
- char *p;
+ _cleanup_free_ char *p = NULL, *q = NULL;
bool found_native = false, found_sysv;
unsigned c = 1;
const char *argv[6] = { "/sbin/chkconfig", NULL, NULL, NULL, NULL };
- char **k, *l, *q = NULL;
+ char **k, *l;
int j;
pid_t pid;
siginfo_t status;
continue;
STRV_FOREACH(k, paths.unit_path) {
- p = NULL;
-
if (!isempty(arg_root))
asprintf(&p, "%s/%s/%s", arg_root, *k, name);
else
found_native = access(p, F_OK) >= 0;
free(p);
+ p = NULL;
if (found_native)
break;
if (found_native)
continue;
- p = NULL;
if (!isempty(arg_root))
asprintf(&p, "%s/" SYSTEM_SYSVINIT_PATH "/%s", arg_root, name);
else
p[strlen(p) - sizeof(".service") + 1] = 0;
found_sysv = access(p, F_OK) >= 0;
- if (!found_sysv) {
- free(p);
+ if (!found_sysv)
continue;
- }
/* Mark this entry, so that we don't try enabling it as native unit */
args[f] = (char*) "";
l = strv_join((char**)argv, " ");
if (!l) {
- free(q);
- free(p);
r = log_oom();
goto finish;
}
pid = fork();
if (pid < 0) {
log_error("Failed to fork: %m");
- free(p);
- free(q);
r = -errno;
goto finish;
} else if (pid == 0) {
_exit(EXIT_FAILURE);
}
- free(p);
- free(q);
-
j = wait_for_terminate(pid, &status);
if (j < 0) {
log_error("Failed to wait for child: %s", strerror(-r));
UnitFileChange *changes = NULL;
unsigned n_changes = 0, i;
int carries_install_info = -1;
- DBusMessage _cleanup_dbus_message_unref_ *m = NULL, *reply = NULL;
+ _cleanup_dbus_message_unref_ DBusMessage *m = NULL, *reply = NULL;
int r;
- DBusError _cleanup_dbus_error_free_ error;
- char _cleanup_strv_free_ **mangled_names = NULL;
+ _cleanup_dbus_error_free_ DBusError error;
+ _cleanup_strv_free_ char **mangled_names = NULL;
dbus_error_init(&error);
}
static int unit_is_enabled(DBusConnection *bus, char **args) {
- DBusError _cleanup_dbus_error_free_ error;
+ _cleanup_dbus_error_free_ DBusError error;
int r;
- DBusMessage _cleanup_dbus_message_unref_ *reply = NULL;
+ _cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
bool enabled;
char **name;
char *n;
" --version Show package version\n"
" -t --type=TYPE List only units of a particular type\n"
" -p --property=NAME Show only properties by this name\n"
- " -a --all Show all units/properties, including dead/empty ones\n"
+ " -a --all Show all loaded units/properties, including dead/empty\n"
+ " ones. To list all units installed on the system, use\n"
+ " the 'list-unit-files' command instead.\n"
" --failed Show only failed units\n"
" --full Don't ellipsize unit names on output\n"
" --fail When queueing a new job, fail if conflicting jobs are\n"
size_t size;
FOREACH_WORD_SEPARATOR(word, size, optarg, ",", state) {
- char _cleanup_free_ *type;
+ _cleanup_free_ char *type;
type = strndup(word, size);
if (!type)
}
static int talk_upstart(void) {
- DBusMessage _cleanup_dbus_message_unref_ *m = NULL, *reply = NULL;
- DBusError _cleanup_dbus_error_free_ error;
+ _cleanup_dbus_message_unref_ DBusMessage *m = NULL, *reply = NULL;
+ _cleanup_dbus_error_free_ DBusError error;
int previous, rl, r;
char
env1_buf[] = "RUNLEVEL=X",
static int talk_initctl(void) {
struct init_request request = {};
int r;
- int _cleanup_close_ fd = -1;
+ _cleanup_close_ int fd = -1;
char rl;
rl = action_to_runlevel();
}
static int send_shutdownd(usec_t t, char mode, bool dry_run, bool warn, const char *message) {
- int _cleanup_close_ fd;
+ _cleanup_close_ int fd;
struct sd_shutdown_command c = {
.usec = t,
.mode = mode,
}
if (arg_when > 0) {
- char _cleanup_free_ *m;
+ _cleanup_free_ char *m;
m = strv_join(arg_wall, " ");
r = send_shutdownd(arg_when,
int main(int argc, char*argv[]) {
int r, retval = EXIT_FAILURE;
DBusConnection *bus = NULL;
- DBusError _cleanup_dbus_error_free_ error;
+ _cleanup_dbus_error_free_ DBusError error;
dbus_error_init(&error);