move _cleanup_ attribute in front of the type
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
This commit is contained in:
parent
d70964d0f6
commit
7fd1b19bc9
|
@ -171,10 +171,10 @@ static int open_sockets(int *epoll_fd, bool accept) {
|
|||
|
||||
static int launch(char* name, char **argv, char **env, int fds) {
|
||||
unsigned n_env = 0, length;
|
||||
char _cleanup_strv_free_ **envp = NULL;
|
||||
_cleanup_strv_free_ char **envp = NULL;
|
||||
char **s;
|
||||
static const char* tocopy[] = {"TERM=", "PATH=", "USER=", "HOME="};
|
||||
char _cleanup_free_ *tmp = NULL;
|
||||
_cleanup_free_ char *tmp = NULL;
|
||||
unsigned i;
|
||||
|
||||
length = strv_length(arg_environ);
|
||||
|
@ -185,7 +185,7 @@ static int launch(char* name, char **argv, char **env, int fds) {
|
|||
if (strchr(*s, '='))
|
||||
envp[n_env++] = *s;
|
||||
else {
|
||||
char _cleanup_free_ *p = strappend(*s, "=");
|
||||
_cleanup_free_ char *p = strappend(*s, "=");
|
||||
if (!p)
|
||||
return log_oom();
|
||||
envp[n_env] = strv_find_prefix(env, p);
|
||||
|
@ -218,7 +218,7 @@ static int launch1(const char* child, char** argv, char **env, int fd) {
|
|||
pid_t parent_pid, child_pid;
|
||||
int r;
|
||||
|
||||
char _cleanup_free_ *tmp = NULL;
|
||||
_cleanup_free_ char *tmp = NULL;
|
||||
tmp = strv_join(argv, " ");
|
||||
if (!tmp)
|
||||
return log_oom();
|
||||
|
|
|
@ -245,7 +245,7 @@ static void do_journal_append(char *file)
|
|||
struct iovec iovec[5];
|
||||
int r, f, j = 0;
|
||||
ssize_t n;
|
||||
char _cleanup_free_ *bootchart_file = NULL, *bootchart_message = NULL,
|
||||
_cleanup_free_ char *bootchart_file = NULL, *bootchart_message = NULL,
|
||||
*p = NULL;
|
||||
|
||||
bootchart_file = strappend("BOOTCHART_FILE=", file);
|
||||
|
|
|
@ -56,7 +56,7 @@ double gettime_ns(void) {
|
|||
}
|
||||
|
||||
void log_uptime(void) {
|
||||
FILE _cleanup_fclose_ *f = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
char str[32];
|
||||
double uptime;
|
||||
|
||||
|
@ -92,7 +92,7 @@ static char *bufgetline(char *buf) {
|
|||
|
||||
static int pid_cmdline_strscpy(char *buffer, size_t buf_len, int pid) {
|
||||
char filename[PATH_MAX];
|
||||
int _cleanup_close_ fd=-1;
|
||||
_cleanup_close_ int fd=-1;
|
||||
ssize_t n;
|
||||
|
||||
sprintf(filename, "%d/cmdline", pid);
|
||||
|
@ -246,7 +246,7 @@ schedstat_next:
|
|||
|
||||
/* end of our LL? then append a new record */
|
||||
if (ps->pid != pid) {
|
||||
FILE _cleanup_fclose_ *st = NULL;
|
||||
_cleanup_fclose_ FILE *st = NULL;
|
||||
char t[32];
|
||||
struct ps_struct *parent;
|
||||
|
||||
|
|
|
@ -389,7 +389,7 @@ static void svg_pss_graph(void) {
|
|||
svg("\n\n<!-- PSS map - csv format -->\n");
|
||||
ps = ps_first;
|
||||
while (ps->next_ps) {
|
||||
char _cleanup_free_ *enc_name = NULL;
|
||||
_cleanup_free_ char *enc_name = NULL;
|
||||
ps = ps->next_ps;
|
||||
if (!ps)
|
||||
continue;
|
||||
|
@ -711,7 +711,7 @@ static int ps_filter(struct ps_struct *ps) {
|
|||
}
|
||||
|
||||
static void svg_do_initcall(int count_only) {
|
||||
FILE _cleanup_pclose_ *f = NULL;
|
||||
_cleanup_pclose_ FILE *f = NULL;
|
||||
double t;
|
||||
char func[256];
|
||||
int ret;
|
||||
|
@ -815,7 +815,7 @@ static void svg_ps_bars(void) {
|
|||
/* pass 2 - ps boxes */
|
||||
ps = ps_first;
|
||||
while ((ps = get_next_ps(ps))) {
|
||||
char _cleanup_free_ *enc_name = NULL;
|
||||
_cleanup_free_ char *enc_name = NULL;
|
||||
|
||||
double starttime;
|
||||
int t;
|
||||
|
|
|
@ -157,7 +157,7 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
} else {
|
||||
char _cleanup_free_ *p;
|
||||
_cleanup_free_ char *p;
|
||||
|
||||
p = get_current_dir_name();
|
||||
if (!p) {
|
||||
|
@ -170,7 +170,7 @@ int main(int argc, char *argv[]) {
|
|||
r = show_cgroup_by_path(p, NULL, 0,
|
||||
arg_kernel_threads, output_flags);
|
||||
} else {
|
||||
char _cleanup_free_ *root = NULL;
|
||||
_cleanup_free_ char *root = NULL;
|
||||
|
||||
r = cg_get_root_path(&root);
|
||||
if (r < 0) {
|
||||
|
|
|
@ -114,7 +114,7 @@ static int bus_socket_append_listen(DBusMessageIter *i, const char *property, vo
|
|||
|
||||
LIST_FOREACH(port, p, s->ports) {
|
||||
const char *type = socket_port_type_to_string(p);
|
||||
char _cleanup_free_ *address = NULL;
|
||||
_cleanup_free_ char *address = NULL;
|
||||
const char *a;
|
||||
|
||||
if (!dbus_message_iter_open_container(&array, DBUS_TYPE_STRUCT, NULL, &stru))
|
||||
|
|
|
@ -314,7 +314,7 @@ static int bus_unit_append_cgroups(DBusMessageIter *i, const char *property, voi
|
|||
return -ENOMEM;
|
||||
|
||||
LIST_FOREACH(by_unit, cgb, u->cgroup_bondings) {
|
||||
char _cleanup_free_ *t = NULL;
|
||||
_cleanup_free_ char *t = NULL;
|
||||
bool success;
|
||||
|
||||
t = cgroup_bonding_to_string(cgb);
|
||||
|
@ -341,7 +341,7 @@ static int bus_unit_append_cgroup_attrs(DBusMessageIter *i, const char *property
|
|||
return -ENOMEM;
|
||||
|
||||
LIST_FOREACH(by_unit, a, u->cgroup_attributes) {
|
||||
char _cleanup_free_ *v = NULL;
|
||||
_cleanup_free_ char *v = NULL;
|
||||
bool success;
|
||||
|
||||
if (a->semantics && a->semantics->map_write)
|
||||
|
|
|
@ -997,7 +997,7 @@ int exec_spawn(ExecCommand *command,
|
|||
int r;
|
||||
char *line;
|
||||
int socket_fd;
|
||||
char _cleanup_strv_free_ **files_env = NULL;
|
||||
_cleanup_strv_free_ char **files_env = NULL;
|
||||
|
||||
assert(command);
|
||||
assert(context);
|
||||
|
@ -1069,7 +1069,7 @@ int exec_spawn(ExecCommand *command,
|
|||
const char *username = NULL, *home = NULL;
|
||||
uid_t uid = (uid_t) -1;
|
||||
gid_t gid = (gid_t) -1;
|
||||
char _cleanup_strv_free_ **our_env = NULL, **pam_env = NULL,
|
||||
_cleanup_strv_free_ char **our_env = NULL, **pam_env = NULL,
|
||||
**final_env = NULL, **final_argv = NULL;
|
||||
unsigned n_env = 0;
|
||||
bool set_access = false;
|
||||
|
@ -1362,7 +1362,7 @@ int exec_spawn(ExecCommand *command,
|
|||
goto fail_child;
|
||||
}
|
||||
} else {
|
||||
char _cleanup_free_ *d = NULL;
|
||||
_cleanup_free_ char *d = NULL;
|
||||
|
||||
if (asprintf(&d, "%s/%s",
|
||||
context->root_directory ? context->root_directory : "",
|
||||
|
@ -1727,7 +1727,7 @@ int exec_context_load_environment(const ExecContext *c, char ***l) {
|
|||
int k;
|
||||
bool ignore = false;
|
||||
char **p;
|
||||
glob_t _cleanup_globfree_ pglob = {};
|
||||
_cleanup_globfree_ glob_t pglob = {};
|
||||
int count, n;
|
||||
|
||||
fn = *i;
|
||||
|
|
|
@ -91,7 +91,7 @@ int config_parse_unit_deps(const char* unit,
|
|||
assert(rvalue);
|
||||
|
||||
FOREACH_WORD_QUOTED(w, l, rvalue, state) {
|
||||
char _cleanup_free_ *t = NULL, *k = NULL;
|
||||
_cleanup_free_ char *t = NULL, *k = NULL;
|
||||
int r;
|
||||
|
||||
t = strndup(w, l);
|
||||
|
@ -785,7 +785,7 @@ int config_parse_exec_cpu_affinity(const char *unit,
|
|||
}
|
||||
|
||||
FOREACH_WORD_QUOTED(w, l, rvalue, state) {
|
||||
char _cleanup_free_ *t = NULL;
|
||||
_cleanup_free_ char *t = NULL;
|
||||
int r;
|
||||
unsigned cpu;
|
||||
|
||||
|
@ -927,7 +927,7 @@ int config_parse_bounding_set(const char *unit,
|
|||
* interface. */
|
||||
|
||||
FOREACH_WORD_QUOTED(w, l, rvalue, state) {
|
||||
char _cleanup_free_ *t = NULL;
|
||||
_cleanup_free_ char *t = NULL;
|
||||
int r;
|
||||
cap_value_t cap;
|
||||
|
||||
|
@ -1019,7 +1019,7 @@ int config_parse_unit_cgroup(const char *unit,
|
|||
}
|
||||
|
||||
FOREACH_WORD_QUOTED(w, l, rvalue, state) {
|
||||
char _cleanup_free_ *t = NULL, *k = NULL, *ku = NULL;
|
||||
_cleanup_free_ char *t = NULL, *k = NULL, *ku = NULL;
|
||||
int r;
|
||||
|
||||
t = strndup(w, l);
|
||||
|
@ -1161,7 +1161,7 @@ int config_parse_exec_mount_flags(const char *unit,
|
|||
assert(data);
|
||||
|
||||
FOREACH_WORD_SEPARATOR(w, l, rvalue, ", ", state) {
|
||||
char _cleanup_free_ *t;
|
||||
_cleanup_free_ char *t;
|
||||
|
||||
t = strndup(w, l);
|
||||
if (!t)
|
||||
|
@ -1314,7 +1314,7 @@ int config_parse_path_spec(const char *unit,
|
|||
Path *p = data;
|
||||
PathSpec *s;
|
||||
PathType b;
|
||||
char _cleanup_free_ *k = NULL;
|
||||
_cleanup_free_ char *k = NULL;
|
||||
|
||||
assert(filename);
|
||||
assert(lvalue);
|
||||
|
@ -1480,7 +1480,7 @@ int config_parse_service_sockets(const char *unit,
|
|||
assert(data);
|
||||
|
||||
FOREACH_WORD_QUOTED(w, l, rvalue, state) {
|
||||
char _cleanup_free_ *t = NULL, *k = NULL;
|
||||
_cleanup_free_ char *t = NULL, *k = NULL;
|
||||
|
||||
t = strndup(w, l);
|
||||
if (!t)
|
||||
|
@ -2074,7 +2074,7 @@ int config_parse_syscall_filter(const char *unit,
|
|||
|
||||
FOREACH_WORD_QUOTED(w, l, rvalue, state) {
|
||||
int id;
|
||||
char _cleanup_free_ *t = NULL;
|
||||
_cleanup_free_ char *t = NULL;
|
||||
|
||||
t = strndup(w, l);
|
||||
if (!t)
|
||||
|
|
|
@ -228,7 +228,7 @@ static int read_response(int fd, unsigned requests_max) {
|
|||
|
||||
static int check_loopback(void) {
|
||||
int r;
|
||||
int _cleanup_close_ fd;
|
||||
_cleanup_close_ int fd;
|
||||
union {
|
||||
struct sockaddr sa;
|
||||
struct sockaddr_in in;
|
||||
|
@ -261,7 +261,7 @@ int loopback_setup(void) {
|
|||
.nl.nl_family = AF_NETLINK,
|
||||
};
|
||||
unsigned requests = 0, i;
|
||||
int _cleanup_close_ fd = -1;
|
||||
_cleanup_close_ int fd = -1;
|
||||
bool eperm = false;
|
||||
|
||||
errno = 0;
|
||||
|
|
|
@ -666,7 +666,7 @@ static int parse_config_file(void) {
|
|||
{ NULL, NULL, NULL, 0, NULL }
|
||||
};
|
||||
|
||||
FILE _cleanup_fclose_ *f;
|
||||
_cleanup_fclose_ FILE *f;
|
||||
const char *fn;
|
||||
int r;
|
||||
|
||||
|
@ -688,7 +688,7 @@ static int parse_config_file(void) {
|
|||
}
|
||||
|
||||
static int parse_proc_cmdline(void) {
|
||||
char _cleanup_free_ *line = NULL;
|
||||
_cleanup_free_ char *line = NULL;
|
||||
char *w, *state;
|
||||
int r;
|
||||
size_t l;
|
||||
|
@ -705,7 +705,7 @@ static int parse_proc_cmdline(void) {
|
|||
}
|
||||
|
||||
FOREACH_WORD_QUOTED(w, l, line, state) {
|
||||
char _cleanup_free_ *word;
|
||||
_cleanup_free_ char *word;
|
||||
|
||||
word = strndup(w, l);
|
||||
if (!word)
|
||||
|
|
|
@ -768,7 +768,7 @@ int manager_coldplug(Manager *m) {
|
|||
|
||||
static void manager_build_unit_path_cache(Manager *m) {
|
||||
char **i;
|
||||
DIR _cleanup_free_ *d = NULL;
|
||||
_cleanup_free_ DIR *d = NULL;
|
||||
int r;
|
||||
|
||||
assert(m);
|
||||
|
@ -1191,7 +1191,7 @@ static int manager_process_notify_fd(Manager *m) {
|
|||
};
|
||||
struct ucred *ucred;
|
||||
Unit *u;
|
||||
char _cleanup_strv_free_ **tags = NULL;
|
||||
_cleanup_strv_free_ char **tags = NULL;
|
||||
|
||||
n = recvmsg(m->notify_watch.fd, &msghdr, MSG_DONTWAIT);
|
||||
if (n <= 0) {
|
||||
|
@ -1264,7 +1264,7 @@ static int manager_dispatch_sigchld(Manager *m) {
|
|||
break;
|
||||
|
||||
if (si.si_code == CLD_EXITED || si.si_code == CLD_KILLED || si.si_code == CLD_DUMPED) {
|
||||
char _cleanup_free_ *name = NULL;
|
||||
_cleanup_free_ char *name = NULL;
|
||||
|
||||
get_process_comm(si.si_pid, &name);
|
||||
log_debug("Got SIGCHLD for process %lu (%s)", (unsigned long) si.si_pid, strna(name));
|
||||
|
|
|
@ -156,7 +156,7 @@ void path_spec_unwatch(PathSpec *s, Unit *u) {
|
|||
}
|
||||
|
||||
int path_spec_fd_event(PathSpec *s, uint32_t events) {
|
||||
uint8_t _cleanup_free_ *buf = NULL;
|
||||
_cleanup_free_ uint8_t *buf = NULL;
|
||||
struct inotify_event *e;
|
||||
ssize_t k;
|
||||
int l;
|
||||
|
|
|
@ -1275,7 +1275,7 @@ static void service_dump(Unit *u, FILE *f, const char *prefix) {
|
|||
ServiceExecCommand c;
|
||||
Service *s = SERVICE(u);
|
||||
const char *prefix2;
|
||||
char _cleanup_free_ *p2 = NULL;
|
||||
_cleanup_free_ char *p2 = NULL;
|
||||
|
||||
assert(s);
|
||||
|
||||
|
@ -1373,7 +1373,7 @@ static void service_dump(Unit *u, FILE *f, const char *prefix) {
|
|||
}
|
||||
|
||||
static int service_load_pid_file(Service *s, bool may_warn) {
|
||||
char _cleanup_free_ *k = NULL;
|
||||
_cleanup_free_ char *k = NULL;
|
||||
int r;
|
||||
pid_t pid;
|
||||
|
||||
|
@ -1740,9 +1740,9 @@ static int service_spawn(
|
|||
pid_t pid;
|
||||
int r;
|
||||
int *fds = NULL;
|
||||
int _cleanup_free_ *fdsbuf = NULL;
|
||||
_cleanup_free_ int *fdsbuf = NULL;
|
||||
unsigned n_fds = 0, n_env = 0;
|
||||
char _cleanup_strv_free_
|
||||
_cleanup_strv_free_ char
|
||||
**argv = NULL, **final_env = NULL, **our_env = NULL;
|
||||
|
||||
assert(s);
|
||||
|
@ -3444,10 +3444,10 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags) {
|
|||
static int service_enumerate(Manager *m) {
|
||||
char **p;
|
||||
unsigned i;
|
||||
DIR _cleanup_closedir_ *d = NULL;
|
||||
char _cleanup_free_ *path = NULL, *fpath = NULL, *name = NULL;
|
||||
_cleanup_closedir_ DIR *d = NULL;
|
||||
_cleanup_free_ char *path = NULL, *fpath = NULL, *name = NULL;
|
||||
Set *runlevel_services[ELEMENTSOF(rcnd_table)] = {};
|
||||
Set _cleanup_set_free_ *shutdown_services = NULL;
|
||||
_cleanup_set_free_ Set *shutdown_services = NULL;
|
||||
Unit *service;
|
||||
Iterator j;
|
||||
int r;
|
||||
|
|
|
@ -214,7 +214,7 @@ static int swap_add_default_dependencies(Swap *s) {
|
|||
|
||||
static int swap_verify(Swap *s) {
|
||||
bool b;
|
||||
char _cleanup_free_ *e = NULL;
|
||||
_cleanup_free_ char *e = NULL;
|
||||
|
||||
if (UNIT(s)->load_state != UNIT_LOADED)
|
||||
return 0;
|
||||
|
@ -315,7 +315,7 @@ static int swap_add_one(
|
|||
bool set_flags) {
|
||||
|
||||
Unit *u = NULL;
|
||||
char _cleanup_free_ *e = NULL;
|
||||
_cleanup_free_ char *e = NULL;
|
||||
char *wp = NULL;
|
||||
bool delete = false;
|
||||
int r;
|
||||
|
|
|
@ -379,7 +379,7 @@ static int delete_loopback(const char *device) {
|
|||
}
|
||||
|
||||
static int delete_dm(dev_t devnum) {
|
||||
int _cleanup_close_ fd = -1;
|
||||
_cleanup_close_ int fd = -1;
|
||||
int r;
|
||||
struct dm_ioctl dm = {
|
||||
.version = {DM_VERSION_MAJOR,
|
||||
|
|
|
@ -124,7 +124,7 @@ static char *specifier_user_name(char specifier, void *data, void *userdata) {
|
|||
ExecContext *c;
|
||||
int r;
|
||||
const char *username;
|
||||
char _cleanup_free_ *tmp = NULL;
|
||||
_cleanup_free_ char *tmp = NULL;
|
||||
uid_t uid;
|
||||
char *printed = NULL;
|
||||
|
||||
|
|
|
@ -70,8 +70,8 @@ static int create_disk(
|
|||
const char *password,
|
||||
const char *options) {
|
||||
|
||||
char _cleanup_free_ *p = NULL, *n = NULL, *d = NULL, *u = NULL, *from = NULL, *to = NULL, *e = NULL;
|
||||
FILE _cleanup_fclose_ *f = NULL;
|
||||
_cleanup_free_ char *p = NULL, *n = NULL, *d = NULL, *u = NULL, *from = NULL, *to = NULL, *e = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
bool noauto, nofail;
|
||||
|
||||
assert(name);
|
||||
|
@ -234,7 +234,7 @@ static int create_disk(
|
|||
}
|
||||
|
||||
static int parse_proc_cmdline(char ***arg_proc_cmdline_disks, char **arg_proc_cmdline_keyfile) {
|
||||
char _cleanup_free_ *line = NULL;
|
||||
_cleanup_free_ char *line = NULL;
|
||||
char *w = NULL, *state = NULL;
|
||||
int r;
|
||||
size_t l;
|
||||
|
@ -249,7 +249,7 @@ static int parse_proc_cmdline(char ***arg_proc_cmdline_disks, char **arg_proc_cm
|
|||
}
|
||||
|
||||
FOREACH_WORD_QUOTED(w, l, line, state) {
|
||||
char _cleanup_free_ *word = NULL;
|
||||
_cleanup_free_ char *word = NULL;
|
||||
|
||||
word = strndup(w, l);
|
||||
if (!word)
|
||||
|
@ -328,13 +328,13 @@ static int parse_proc_cmdline(char ***arg_proc_cmdline_disks, char **arg_proc_cm
|
|||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
FILE _cleanup_fclose_ *f = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
unsigned n = 0;
|
||||
int r = EXIT_SUCCESS;
|
||||
char **i;
|
||||
char _cleanup_strv_free_ **arg_proc_cmdline_disks_done = NULL;
|
||||
char _cleanup_strv_free_ **arg_proc_cmdline_disks = NULL;
|
||||
char _cleanup_free_ *arg_proc_cmdline_keyfile = NULL;
|
||||
_cleanup_strv_free_ char **arg_proc_cmdline_disks_done = NULL;
|
||||
_cleanup_strv_free_ char **arg_proc_cmdline_disks = NULL;
|
||||
_cleanup_free_ char *arg_proc_cmdline_keyfile = NULL;
|
||||
|
||||
if (argc > 1 && argc != 4) {
|
||||
log_error("This program takes three or no arguments.");
|
||||
|
@ -368,7 +368,7 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
} else for (;;) {
|
||||
char line[LINE_MAX], *l;
|
||||
char _cleanup_free_ *name = NULL, *device = NULL, *password = NULL, *options = NULL;
|
||||
_cleanup_free_ char *name = NULL, *device = NULL, *password = NULL, *options = NULL;
|
||||
int k;
|
||||
|
||||
if (!fgets(line, sizeof(line), f))
|
||||
|
@ -393,7 +393,7 @@ int main(int argc, char *argv[]) {
|
|||
for /etc/crypttab and only generate units for those.
|
||||
*/
|
||||
STRV_FOREACH(i, arg_proc_cmdline_disks) {
|
||||
char _cleanup_free_ *proc_device = NULL, *proc_name = NULL;
|
||||
_cleanup_free_ char *proc_device = NULL, *proc_name = NULL;
|
||||
const char *p = *i;
|
||||
|
||||
if (startswith(p, "luks-"))
|
||||
|
@ -426,7 +426,7 @@ int main(int argc, char *argv[]) {
|
|||
on the kernel command line and not yet written.
|
||||
*/
|
||||
|
||||
char _cleanup_free_ *name = NULL, *device = NULL;
|
||||
_cleanup_free_ char *name = NULL, *device = NULL;
|
||||
const char *p = *i;
|
||||
|
||||
if (startswith(p, "luks-"))
|
||||
|
|
|
@ -80,8 +80,8 @@ static int mount_find_pri(struct mntent *me, int *ret) {
|
|||
}
|
||||
|
||||
static int add_swap(const char *what, struct mntent *me) {
|
||||
char _cleanup_free_ *name = NULL, *unit = NULL, *lnk = NULL, *device = NULL;
|
||||
FILE _cleanup_fclose_ *f = NULL;
|
||||
_cleanup_free_ char *name = NULL, *unit = NULL, *lnk = NULL, *device = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
bool noauto, nofail;
|
||||
int r, pri = -1;
|
||||
|
||||
|
@ -214,10 +214,10 @@ static int add_mount(
|
|||
const char *online,
|
||||
const char *post,
|
||||
const char *source) {
|
||||
char _cleanup_free_
|
||||
_cleanup_free_ char
|
||||
*name = NULL, *unit = NULL, *lnk = NULL, *device = NULL,
|
||||
*automount_name = NULL, *automount_unit = NULL;
|
||||
FILE _cleanup_fclose_ *f = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
int r;
|
||||
|
||||
assert(what);
|
||||
|
@ -425,7 +425,7 @@ static int parse_fstab(const char *prefix, bool initrd) {
|
|||
}
|
||||
|
||||
while ((me = getmntent(f))) {
|
||||
char _cleanup_free_ *where = NULL, *what = NULL;
|
||||
_cleanup_free_ char *where = NULL, *what = NULL;
|
||||
int k;
|
||||
|
||||
if (initrd && !mount_in_initrd(me))
|
||||
|
@ -565,7 +565,7 @@ static int parse_new_root_from_proc_cmdline(void) {
|
|||
}
|
||||
|
||||
static int parse_proc_cmdline(void) {
|
||||
char _cleanup_free_ *line = NULL;
|
||||
_cleanup_free_ char *line = NULL;
|
||||
char *w, *state;
|
||||
int r;
|
||||
size_t l;
|
||||
|
@ -580,7 +580,7 @@ static int parse_proc_cmdline(void) {
|
|||
}
|
||||
|
||||
FOREACH_WORD_QUOTED(w, l, line, state) {
|
||||
char _cleanup_free_ *word = NULL;
|
||||
_cleanup_free_ char *word = NULL;
|
||||
|
||||
word = strndup(w, l);
|
||||
if (!word)
|
||||
|
|
|
@ -277,7 +277,7 @@ static long write_catalog(const char *database, Hashmap *h, struct strbuf *sb,
|
|||
CatalogHeader header;
|
||||
_cleanup_fclose_ FILE *w = NULL;
|
||||
int r;
|
||||
char _cleanup_free_ *d, *p = NULL;
|
||||
_cleanup_free_ char *d, *p = NULL;
|
||||
size_t k;
|
||||
|
||||
d = dirname_malloc(database);
|
||||
|
@ -627,7 +627,7 @@ int catalog_list_items(FILE *f, const char *database, bool oneline, char **items
|
|||
STRV_FOREACH(item, items) {
|
||||
sd_id128_t id;
|
||||
int k;
|
||||
char _cleanup_free_ *msg = NULL;
|
||||
_cleanup_free_ char *msg = NULL;
|
||||
|
||||
k = sd_id128_from_string(*item, &id);
|
||||
if (k < 0) {
|
||||
|
|
|
@ -103,7 +103,7 @@ int main(int argc, char* argv[]) {
|
|||
uid_t uid;
|
||||
gid_t gid;
|
||||
struct iovec iovec[14];
|
||||
char _cleanup_free_ *core_pid = NULL, *core_uid = NULL, *core_gid = NULL, *core_signal = NULL,
|
||||
_cleanup_free_ char *core_pid = NULL, *core_uid = NULL, *core_gid = NULL, *core_signal = NULL,
|
||||
*core_timestamp = NULL, *core_comm = NULL, *core_exe = NULL, *core_unit = NULL,
|
||||
*core_session = NULL, *core_message = NULL, *core_cmdline = NULL, *p = NULL;
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ static int add_match(Set *set, const char *match) {
|
|||
unsigned pid;
|
||||
const char* prefix;
|
||||
char *pattern = NULL;
|
||||
char _cleanup_free_ *p = NULL;
|
||||
_cleanup_free_ char *p = NULL;
|
||||
|
||||
if (strchr(match, '='))
|
||||
prefix = "";
|
||||
|
@ -269,7 +269,7 @@ static int retrieve(const void *data,
|
|||
}
|
||||
|
||||
static void print_field(FILE* file, sd_journal *j) {
|
||||
const char _cleanup_free_ *value = NULL;
|
||||
_cleanup_free_ const char *value = NULL;
|
||||
const void *d;
|
||||
size_t l;
|
||||
|
||||
|
@ -282,7 +282,7 @@ static void print_field(FILE* file, sd_journal *j) {
|
|||
}
|
||||
|
||||
static int print_entry(FILE* file, sd_journal *j, int had_legend) {
|
||||
const char _cleanup_free_
|
||||
_cleanup_free_ const char
|
||||
*pid = NULL, *uid = NULL, *gid = NULL,
|
||||
*sgnl = NULL, *exe = NULL;
|
||||
const void *d;
|
||||
|
@ -520,11 +520,11 @@ finish:
|
|||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
sd_journal _cleanup_journal_close_ *j = NULL;
|
||||
_cleanup_journal_close_ sd_journal*j = NULL;
|
||||
const char* match;
|
||||
Iterator it;
|
||||
int r = 0;
|
||||
Set _cleanup_set_free_free_ *matches = NULL;
|
||||
_cleanup_set_free_free_ Set *matches = NULL;
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
log_parse_environment();
|
||||
|
|
|
@ -335,7 +335,7 @@ static int request_parse_range(
|
|||
|
||||
colon2 = strchr(colon + 1, ':');
|
||||
if (colon2) {
|
||||
char _cleanup_free_ *t;
|
||||
_cleanup_free_ char *t;
|
||||
|
||||
t = strndup(colon + 1, colon2 - colon - 1);
|
||||
if (!t)
|
||||
|
|
|
@ -544,7 +544,7 @@ static int add_matches(sd_journal *j, char **args) {
|
|||
if (streq(*i, "+"))
|
||||
r = sd_journal_add_disjunction(j);
|
||||
else if (path_is_absolute(*i)) {
|
||||
char _cleanup_free_ *p, *t = NULL;
|
||||
_cleanup_free_ char *p, *t = NULL;
|
||||
const char *path;
|
||||
struct stat st;
|
||||
|
||||
|
@ -1028,7 +1028,7 @@ static int access_check(sd_journal *j) {
|
|||
|
||||
int main(int argc, char *argv[]) {
|
||||
int r;
|
||||
sd_journal _cleanup_journal_close_ *j = NULL;
|
||||
_cleanup_journal_close_ sd_journal*j = NULL;
|
||||
bool need_seek = false;
|
||||
sd_id128_t previous_boot_id;
|
||||
bool previous_boot_id_valid = false, first_line = true;
|
||||
|
@ -1059,7 +1059,7 @@ int main(int argc, char *argv[]) {
|
|||
arg_action == ACTION_DUMP_CATALOG) {
|
||||
|
||||
const char* database = CATALOG_DATABASE;
|
||||
char _cleanup_free_ *copy = NULL;
|
||||
_cleanup_free_ char *copy = NULL;
|
||||
if (arg_root) {
|
||||
copy = strjoin(arg_root, "/", CATALOG_DATABASE, NULL);
|
||||
if (!copy) {
|
||||
|
|
|
@ -95,13 +95,13 @@ DEFINE_CONFIG_PARSE_ENUM(config_parse_split_mode, split_mode, SplitMode, "Failed
|
|||
|
||||
static uint64_t available_space(Server *s) {
|
||||
char ids[33];
|
||||
char _cleanup_free_ *p = NULL;
|
||||
_cleanup_free_ char *p = NULL;
|
||||
const char *f;
|
||||
sd_id128_t machine;
|
||||
struct statvfs ss;
|
||||
uint64_t sum = 0, avail = 0, ss_avail = 0;
|
||||
int r;
|
||||
DIR _cleanup_closedir_ *d = NULL;
|
||||
_cleanup_closedir_ DIR *d = NULL;
|
||||
usec_t ts;
|
||||
JournalMetrics *m;
|
||||
|
||||
|
@ -512,12 +512,12 @@ static void dispatch_message_real(
|
|||
boot_id[sizeof("_BOOT_ID=") + 32] = "_BOOT_ID=",
|
||||
machine_id[sizeof("_MACHINE_ID=") + 32] = "_MACHINE_ID=";
|
||||
|
||||
char _cleanup_free_ *comm = NULL, *cmdline = NULL, *hostname = NULL,
|
||||
_cleanup_free_ char *comm = NULL, *cmdline = NULL, *hostname = NULL,
|
||||
*exe = NULL, *cgroup = NULL, *session = NULL,
|
||||
*owner_uid = NULL, *unit = NULL, *selinux_context = NULL;
|
||||
|
||||
#ifdef HAVE_AUDIT
|
||||
char _cleanup_free_ *audit_session = NULL, *audit_loginuid = NULL;
|
||||
_cleanup_free_ char *audit_session = NULL, *audit_loginuid = NULL;
|
||||
#endif
|
||||
|
||||
sd_id128_t id;
|
||||
|
@ -745,7 +745,7 @@ void server_dispatch_message(
|
|||
int priority) {
|
||||
|
||||
int rl, r;
|
||||
char _cleanup_free_ *path = NULL;
|
||||
_cleanup_free_ char *path = NULL;
|
||||
char *c;
|
||||
|
||||
assert(s);
|
||||
|
@ -1247,7 +1247,7 @@ static int open_signalfd(Server *s) {
|
|||
}
|
||||
|
||||
static int server_parse_proc_cmdline(Server *s) {
|
||||
char _cleanup_free_ *line = NULL;
|
||||
_cleanup_free_ char *line = NULL;
|
||||
char *w, *state;
|
||||
int r;
|
||||
size_t l;
|
||||
|
@ -1262,7 +1262,7 @@ static int server_parse_proc_cmdline(Server *s) {
|
|||
}
|
||||
|
||||
FOREACH_WORD_QUOTED(w, l, line, state) {
|
||||
char _cleanup_free_ *word;
|
||||
_cleanup_free_ char *word;
|
||||
|
||||
word = strndup(w, l);
|
||||
if (!word)
|
||||
|
@ -1295,7 +1295,7 @@ static int server_parse_proc_cmdline(Server *s) {
|
|||
|
||||
static int server_parse_config_file(Server *s) {
|
||||
static const char *fn = "/etc/systemd/journald.conf";
|
||||
FILE _cleanup_fclose_ *f = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
int r;
|
||||
|
||||
assert(s);
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "util.h"
|
||||
|
||||
void microhttpd_logger(void *arg, const char *fmt, va_list ap) {
|
||||
char _cleanup_free_ *f;
|
||||
_cleanup_free_ char *f;
|
||||
if (asprintf(&f, "microhttpd: %s", fmt) <= 0) {
|
||||
log_oom();
|
||||
return;
|
||||
|
|
|
@ -1256,7 +1256,7 @@ static void check_network(sd_journal *j, int fd) {
|
|||
}
|
||||
|
||||
static int add_file(sd_journal *j, const char *prefix, const char *filename) {
|
||||
char _cleanup_free_ *path = NULL;
|
||||
_cleanup_free_ char *path = NULL;
|
||||
int r;
|
||||
JournalFile *f;
|
||||
|
||||
|
@ -1347,9 +1347,9 @@ static int remove_file(sd_journal *j, const char *prefix, const char *filename)
|
|||
}
|
||||
|
||||
static int add_directory(sd_journal *j, const char *prefix, const char *dirname) {
|
||||
char _cleanup_free_ *path = NULL;
|
||||
_cleanup_free_ char *path = NULL;
|
||||
int r;
|
||||
DIR _cleanup_closedir_ *d = NULL;
|
||||
_cleanup_closedir_ DIR *d = NULL;
|
||||
sd_id128_t id, mid;
|
||||
Directory *m;
|
||||
|
||||
|
@ -1437,7 +1437,7 @@ static int add_directory(sd_journal *j, const char *prefix, const char *dirname)
|
|||
}
|
||||
|
||||
static int add_root_directory(sd_journal *j, const char *p) {
|
||||
DIR _cleanup_closedir_ *d = NULL;
|
||||
_cleanup_closedir_ DIR *d = NULL;
|
||||
Directory *m;
|
||||
int r;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ static void test_import(Hashmap *h, struct strbuf *sb,
|
|||
const char* contents, ssize_t size, int code) {
|
||||
int r;
|
||||
char name[] = "/tmp/test-catalog.XXXXXX";
|
||||
int _cleanup_close_ fd = mkstemp(name);
|
||||
_cleanup_close_ int fd = mkstemp(name);
|
||||
assert(fd >= 0);
|
||||
assert_se(write(fd, contents, size) == size);
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
int main(int argc, char *argv[]) {
|
||||
unsigned n = 0;
|
||||
sd_journal _cleanup_journal_close_ *j = NULL;
|
||||
_cleanup_journal_close_ sd_journal*j = NULL;
|
||||
|
||||
log_set_max_level(LOG_DEBUG);
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
#include "log.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
sd_journal _cleanup_journal_close_ *j;
|
||||
char _cleanup_free_ *t;
|
||||
_cleanup_journal_close_ sd_journal*j;
|
||||
_cleanup_free_ char *t;
|
||||
|
||||
log_set_max_level(LOG_DEBUG);
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ int main(int argc, char *argv[]) {
|
|||
JournalFile *one, *two, *three;
|
||||
char t[] = "/tmp/journal-stream-XXXXXX";
|
||||
unsigned i;
|
||||
sd_journal _cleanup_journal_close_ *j = NULL;
|
||||
_cleanup_journal_close_ sd_journal*j = NULL;
|
||||
char *z;
|
||||
const void *data;
|
||||
size_t l;
|
||||
|
@ -126,7 +126,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
assert_se(sd_journal_add_match(j, "MAGIC=quux", 0) >= 0);
|
||||
SD_JOURNAL_FOREACH_BACKWARDS(j) {
|
||||
char _cleanup_free_ *c;
|
||||
_cleanup_free_ char *c;
|
||||
|
||||
assert_se(sd_journal_get_data(j, "NUMBER", &data, &l) >= 0);
|
||||
printf("\t%.*s\n", (int) l, (const char*) data);
|
||||
|
@ -136,7 +136,7 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
SD_JOURNAL_FOREACH(j) {
|
||||
char _cleanup_free_ *c;
|
||||
_cleanup_free_ char *c;
|
||||
|
||||
assert_se(sd_journal_get_data(j, "NUMBER", &data, &l) >= 0);
|
||||
printf("\t%.*s\n", (int) l, (const char*) data);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
static void test_syslog_parse_identifier(const char* str,
|
||||
const char *ident, const char*pid, int ret) {
|
||||
const char *buf = str;
|
||||
char _cleanup_free_ *ident2 = NULL, *pid2 = NULL;
|
||||
_cleanup_free_ char *ident2 = NULL, *pid2 = NULL;
|
||||
int ret2;
|
||||
|
||||
ret2 = syslog_parse_identifier(&buf, &ident2, &pid2);
|
||||
|
|
|
@ -387,7 +387,7 @@ static int add_locales_from_archive(Set *locales) {
|
|||
}
|
||||
|
||||
static int add_locales_from_libdir (Set *locales) {
|
||||
DIR _cleanup_closedir_ *dir;
|
||||
_cleanup_closedir_ DIR *dir;
|
||||
struct dirent *entry;
|
||||
int r;
|
||||
|
||||
|
@ -539,7 +539,7 @@ static int nftw_cb(
|
|||
}
|
||||
|
||||
static int list_vconsole_keymaps(DBusConnection *bus, char **args, unsigned n) {
|
||||
char _cleanup_strv_free_ **l = NULL;
|
||||
_cleanup_strv_free_ char **l = NULL;
|
||||
|
||||
keymaps = set_new(string_hash_func, string_compare_func);
|
||||
if (!keymaps)
|
||||
|
@ -611,7 +611,7 @@ static int set_x11_keymap(DBusConnection *bus, char **args, unsigned n) {
|
|||
|
||||
static int list_x11_keymaps(DBusConnection *bus, char **args, unsigned n) {
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
char _cleanup_strv_free_ **list = NULL;
|
||||
_cleanup_strv_free_ char **list = NULL;
|
||||
char line[LINE_MAX];
|
||||
enum {
|
||||
NONE,
|
||||
|
|
|
@ -229,7 +229,7 @@ int main(int argc, char *argv[]) {
|
|||
int r, exit_code = 0;
|
||||
DBusConnection *bus = NULL;
|
||||
DBusError error;
|
||||
int _cleanup_close_ fd = -1;
|
||||
_cleanup_close_ int fd = -1;
|
||||
|
||||
dbus_error_init(&error);
|
||||
|
||||
|
|
|
@ -922,7 +922,7 @@ finish:
|
|||
|
||||
static int attach_device(Manager *m, const char *seat, const char *sysfs) {
|
||||
struct udev_device *d;
|
||||
char _cleanup_free_ *rule = NULL, *file = NULL;
|
||||
_cleanup_free_ char *rule = NULL, *file = NULL;
|
||||
const char *id_for_seat;
|
||||
int r;
|
||||
|
||||
|
@ -971,7 +971,7 @@ finish:
|
|||
}
|
||||
|
||||
static int flush_devices(Manager *m) {
|
||||
DIR _cleanup_closedir_ *d;
|
||||
_cleanup_closedir_ DIR *d;
|
||||
|
||||
assert(m);
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ static int bus_seat_append_active(DBusMessageIter *i, const char *property, void
|
|||
DBusMessageIter sub;
|
||||
Seat *s = data;
|
||||
const char *id, *path;
|
||||
char _cleanup_free_ *p = NULL;
|
||||
_cleanup_free_ char *p = NULL;
|
||||
|
||||
assert(i);
|
||||
assert(property);
|
||||
|
@ -104,7 +104,7 @@ static int bus_seat_append_sessions(DBusMessageIter *i, const char *property, vo
|
|||
return -ENOMEM;
|
||||
|
||||
LIST_FOREACH(sessions_by_seat, session, s->sessions) {
|
||||
char _cleanup_free_ *p = NULL;
|
||||
_cleanup_free_ char *p = NULL;
|
||||
|
||||
if (!dbus_message_iter_open_container(&sub, DBUS_TYPE_STRUCT, NULL, &sub2))
|
||||
return -ENOMEM;
|
||||
|
@ -348,7 +348,7 @@ const DBusObjectPathVTable bus_seat_vtable = {
|
|||
};
|
||||
|
||||
char *seat_bus_path(Seat *s) {
|
||||
char _cleanup_free_ *t;
|
||||
_cleanup_free_ char *t;
|
||||
|
||||
assert(s);
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ static int bus_session_append_seat(DBusMessageIter *i, const char *property, voi
|
|||
static int bus_session_append_user(DBusMessageIter *i, const char *property, void *data) {
|
||||
DBusMessageIter sub;
|
||||
User *u = data;
|
||||
char _cleanup_free_ *p = NULL;
|
||||
_cleanup_free_ char *p = NULL;
|
||||
|
||||
assert(i);
|
||||
assert(property);
|
||||
|
@ -197,7 +197,7 @@ static int bus_session_append_idle_hint_since(DBusMessageIter *i, const char *pr
|
|||
|
||||
static int bus_session_append_default_cgroup(DBusMessageIter *i, const char *property, void *data) {
|
||||
Session *s = data;
|
||||
char _cleanup_free_ *t = NULL;
|
||||
_cleanup_free_ char *t = NULL;
|
||||
int r;
|
||||
bool success;
|
||||
|
||||
|
@ -448,7 +448,7 @@ const DBusObjectPathVTable bus_session_vtable = {
|
|||
};
|
||||
|
||||
char *session_bus_path(Session *s) {
|
||||
char _cleanup_free_ *t;
|
||||
_cleanup_free_ char *t;
|
||||
|
||||
assert(s);
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ static int bus_user_append_display(DBusMessageIter *i, const char *property, voi
|
|||
DBusMessageIter sub;
|
||||
User *u = data;
|
||||
const char *id, *path;
|
||||
char _cleanup_free_ *p = NULL;
|
||||
_cleanup_free_ char *p = NULL;
|
||||
|
||||
assert(i);
|
||||
assert(property);
|
||||
|
@ -187,7 +187,7 @@ static int bus_user_append_idle_hint_since(DBusMessageIter *i, const char *prope
|
|||
|
||||
static int bus_user_append_default_cgroup(DBusMessageIter *i, const char *property, void *data) {
|
||||
User *u = data;
|
||||
char _cleanup_free_ *t = NULL;
|
||||
_cleanup_free_ char *t = NULL;
|
||||
int r;
|
||||
bool success;
|
||||
|
||||
|
|
|
@ -256,15 +256,15 @@ static bool check_user_lists(
|
|||
}
|
||||
|
||||
static int get_seat_from_display(const char *display, const char **seat, uint32_t *vtnr) {
|
||||
char _cleanup_free_ *p = NULL;
|
||||
_cleanup_free_ char *p = NULL;
|
||||
int r;
|
||||
int _cleanup_close_ fd = -1;
|
||||
_cleanup_close_ int fd = -1;
|
||||
union sockaddr_union sa = {
|
||||
.un.sun_family = AF_UNIX,
|
||||
};
|
||||
struct ucred ucred;
|
||||
socklen_t l;
|
||||
char _cleanup_free_ *tty = NULL;
|
||||
_cleanup_free_ char *tty = NULL;
|
||||
int v;
|
||||
|
||||
assert(display);
|
||||
|
|
|
@ -76,7 +76,7 @@ static int add_modules(const char *p) {
|
|||
}
|
||||
|
||||
static int parse_proc_cmdline(void) {
|
||||
char _cleanup_free_ *line = NULL;
|
||||
_cleanup_free_ char *line = NULL;
|
||||
char *w, *state;
|
||||
int r;
|
||||
size_t l;
|
||||
|
@ -91,7 +91,7 @@ static int parse_proc_cmdline(void) {
|
|||
}
|
||||
|
||||
FOREACH_WORD_QUOTED(w, l, line, state) {
|
||||
char _cleanup_free_ *word;
|
||||
_cleanup_free_ char *word;
|
||||
|
||||
word = strndup(w, l);
|
||||
if (!word)
|
||||
|
|
|
@ -365,7 +365,7 @@ static int mount_all(const char *dest) {
|
|||
int r = 0;
|
||||
|
||||
for (k = 0; k < ELEMENTSOF(mount_table); k++) {
|
||||
char _cleanup_free_ *where = NULL;
|
||||
_cleanup_free_ char *where = NULL;
|
||||
int t;
|
||||
|
||||
where = strjoin(dest, "/", mount_table[k].where, NULL);
|
||||
|
@ -515,7 +515,7 @@ static int setup_resolv_conf(const char *dest) {
|
|||
}
|
||||
|
||||
static int setup_boot_id(const char *dest) {
|
||||
char _cleanup_free_ *from = NULL, *to = NULL;
|
||||
_cleanup_free_ char *from = NULL, *to = NULL;
|
||||
sd_id128_t rnd;
|
||||
char as_uuid[37];
|
||||
int r;
|
||||
|
@ -569,7 +569,7 @@ static int copy_devnodes(const char *dest) {
|
|||
|
||||
const char *d;
|
||||
int r = 0;
|
||||
mode_t _cleanup_umask_ u;
|
||||
_cleanup_umask_ mode_t u;
|
||||
|
||||
assert(dest);
|
||||
|
||||
|
@ -577,7 +577,7 @@ static int copy_devnodes(const char *dest) {
|
|||
|
||||
NULSTR_FOREACH(d, devnodes) {
|
||||
struct stat st;
|
||||
char _cleanup_free_ *from = NULL, *to = NULL;
|
||||
_cleanup_free_ char *from = NULL, *to = NULL;
|
||||
|
||||
asprintf(&from, "/dev/%s", d);
|
||||
asprintf(&to, "%s/dev/%s", dest, d);
|
||||
|
@ -633,9 +633,9 @@ static int setup_ptmx(const char *dest) {
|
|||
|
||||
static int setup_dev_console(const char *dest, const char *console) {
|
||||
struct stat st;
|
||||
char _cleanup_free_ *to = NULL;
|
||||
_cleanup_free_ char *to = NULL;
|
||||
int r;
|
||||
mode_t _cleanup_umask_ u;
|
||||
_cleanup_umask_ mode_t u;
|
||||
|
||||
assert(dest);
|
||||
assert(console);
|
||||
|
@ -681,9 +681,9 @@ static int setup_dev_console(const char *dest, const char *console) {
|
|||
}
|
||||
|
||||
static int setup_kmsg(const char *dest, int kmsg_socket) {
|
||||
char _cleanup_free_ *from = NULL, *to = NULL;
|
||||
_cleanup_free_ char *from = NULL, *to = NULL;
|
||||
int r, fd, k;
|
||||
mode_t _cleanup_umask_ u;
|
||||
_cleanup_umask_ mode_t u;
|
||||
union {
|
||||
struct cmsghdr cmsghdr;
|
||||
uint8_t buf[CMSG_SPACE(sizeof(int))];
|
||||
|
@ -765,7 +765,7 @@ static int setup_hostname(void) {
|
|||
|
||||
static int setup_journal(const char *directory) {
|
||||
sd_id128_t machine_id;
|
||||
char _cleanup_free_ *p = NULL, *b = NULL, *q = NULL, *d = NULL;
|
||||
_cleanup_free_ char *p = NULL, *b = NULL, *q = NULL, *d = NULL;
|
||||
char *id;
|
||||
int r;
|
||||
|
||||
|
|
|
@ -379,7 +379,7 @@ enum nss_status _nss_myhostname_gethostbyaddr2_r(
|
|||
int32_t *ttlp) {
|
||||
|
||||
char hn[HOST_NAME_MAX+1] = {};
|
||||
struct address _cleanup_free_ *addresses = NULL;
|
||||
_cleanup_free_ struct address *addresses = NULL;
|
||||
struct address *a;
|
||||
unsigned n_addresses = 0, n;
|
||||
|
||||
|
|
|
@ -244,7 +244,7 @@ static PyObject* is_socket_unix(PyObject *self, PyObject *args) {
|
|||
Py_ssize_t length = 0;
|
||||
|
||||
#if PY_MAJOR_VERSION >=3 && PY_MINOR_VERSION >= 1
|
||||
PyObject _cleanup_Py_DECREF_ *_path = NULL;
|
||||
_cleanup_Py_DECREF_ PyObject *_path = NULL;
|
||||
if (!PyArg_ParseTuple(args, "i|iiO&:_is_socket_unix",
|
||||
&fd, &type, &listening, Unicode_FSConverter, &_path))
|
||||
return NULL;
|
||||
|
|
|
@ -429,7 +429,7 @@ static PyObject* Reader_get_all(Reader *self, PyObject *args)
|
|||
return NULL;
|
||||
|
||||
SD_JOURNAL_FOREACH_DATA(self->j, msg, msg_len) {
|
||||
PyObject _cleanup_Py_DECREF_ *key = NULL, *value = NULL;
|
||||
_cleanup_Py_DECREF_ PyObject *key = NULL, *value = NULL;
|
||||
|
||||
r = extract(msg, msg_len, &key, &value);
|
||||
if (r < 0)
|
||||
|
@ -443,7 +443,7 @@ static PyObject* Reader_get_all(Reader *self, PyObject *args)
|
|||
if (r < 0)
|
||||
goto error;
|
||||
} else {
|
||||
PyObject _cleanup_Py_DECREF_ *tmp_list = PyList_New(0);
|
||||
_cleanup_Py_DECREF_ PyObject *tmp_list = PyList_New(0);
|
||||
if (!tmp_list)
|
||||
goto error;
|
||||
|
||||
|
@ -760,7 +760,7 @@ PyDoc_STRVAR(Reader_get_cursor__doc__,
|
|||
"Wraps sd_journal_get_cursor(). See man:sd_journal_get_cursor(3).");
|
||||
static PyObject* Reader_get_cursor(Reader *self, PyObject *args)
|
||||
{
|
||||
char _cleanup_free_ *cursor = NULL;
|
||||
_cleanup_free_ char *cursor = NULL;
|
||||
int r;
|
||||
|
||||
assert(self);
|
||||
|
@ -846,7 +846,7 @@ PyDoc_STRVAR(Reader_get_catalog__doc__,
|
|||
static PyObject* Reader_get_catalog(Reader *self, PyObject *args)
|
||||
{
|
||||
int r;
|
||||
char _cleanup_free_ *msg = NULL;
|
||||
_cleanup_free_ char *msg = NULL;
|
||||
|
||||
assert(self);
|
||||
assert(!args);
|
||||
|
@ -885,7 +885,7 @@ static PyObject* get_catalog(PyObject *self, PyObject *args)
|
|||
int r;
|
||||
char *id_ = NULL;
|
||||
sd_id128_t id;
|
||||
char _cleanup_free_ *msg = NULL;
|
||||
_cleanup_free_ char *msg = NULL;
|
||||
|
||||
assert(!self);
|
||||
assert(args);
|
||||
|
|
|
@ -52,7 +52,7 @@ PyDoc_STRVAR(get_boot__doc__,
|
|||
);
|
||||
|
||||
static PyObject* make_uuid(sd_id128_t id) {
|
||||
PyObject _cleanup_Py_DECREF_
|
||||
_cleanup_Py_DECREF_ PyObject
|
||||
*uuid = NULL, *UUID = NULL, *bytes = NULL,
|
||||
*args = NULL, *kwargs = NULL;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
int main_analyze(const char *pack_path) {
|
||||
char line[LINE_MAX];
|
||||
FILE _cleanup_fclose_ *pack = NULL;
|
||||
_cleanup_fclose_ FILE *pack = NULL;
|
||||
int a;
|
||||
int missing = 0;
|
||||
size_t tsize = 0;
|
||||
|
|
|
@ -237,7 +237,7 @@ int show_cgroup(const char *controller, const char *path, const char *prefix, un
|
|||
}
|
||||
|
||||
static int show_extra_pids(const char *controller, const char *path, const char *prefix, unsigned n_columns, const pid_t pids[], unsigned n_pids, OutputFlags flags) {
|
||||
pid_t _cleanup_free_ *copy = NULL;
|
||||
_cleanup_free_ pid_t *copy = NULL;
|
||||
unsigned i, j;
|
||||
int r;
|
||||
|
||||
|
@ -257,7 +257,7 @@ static int show_extra_pids(const char *controller, const char *path, const char
|
|||
return -ENOMEM;
|
||||
|
||||
for (i = 0, j = 0; i < n_pids; i++) {
|
||||
char _cleanup_free_ *k = NULL;
|
||||
_cleanup_free_ char *k = NULL;
|
||||
|
||||
r = cg_pid_get_path(controller, pids[i], &k);
|
||||
if (r < 0)
|
||||
|
|
|
@ -1250,7 +1250,7 @@ int cg_path_get_unit(const char *path, char **unit) {
|
|||
}
|
||||
|
||||
int cg_pid_get_unit(pid_t pid, char **unit) {
|
||||
char _cleanup_free_ *cgroup = NULL;
|
||||
_cleanup_free_ char *cgroup = NULL;
|
||||
int r;
|
||||
|
||||
assert(unit);
|
||||
|
@ -1306,7 +1306,7 @@ int cg_path_get_user_unit(const char *path, char **unit) {
|
|||
}
|
||||
|
||||
int cg_pid_get_user_unit(pid_t pid, char **unit) {
|
||||
char _cleanup_free_ *cgroup = NULL;
|
||||
_cleanup_free_ char *cgroup = NULL;
|
||||
int r;
|
||||
|
||||
assert(unit);
|
||||
|
@ -1342,7 +1342,7 @@ int cg_path_get_machine_name(const char *path, char **machine) {
|
|||
}
|
||||
|
||||
int cg_pid_get_machine_name(pid_t pid, char **machine) {
|
||||
char _cleanup_free_ *cgroup = NULL;
|
||||
_cleanup_free_ char *cgroup = NULL;
|
||||
int r;
|
||||
|
||||
assert(machine);
|
||||
|
@ -1386,7 +1386,7 @@ int cg_path_get_session(const char *path, char **session) {
|
|||
}
|
||||
|
||||
int cg_pid_get_session(pid_t pid, char **session) {
|
||||
char _cleanup_free_ *cgroup = NULL;
|
||||
_cleanup_free_ char *cgroup = NULL;
|
||||
int r;
|
||||
|
||||
assert(session);
|
||||
|
|
|
@ -219,7 +219,7 @@ static int parse_line(const char* unit,
|
|||
return 0;
|
||||
|
||||
if (startswith(l, ".include ")) {
|
||||
char _cleanup_free_ *fn;
|
||||
_cleanup_free_ char *fn;
|
||||
|
||||
fn = file_in_same_dir(filename, strstrip(l+9));
|
||||
if (!fn)
|
||||
|
@ -302,8 +302,8 @@ int config_parse(const char *unit,
|
|||
void *userdata) {
|
||||
|
||||
unsigned line = 0;
|
||||
char _cleanup_free_ *section = NULL, *continuation = NULL;
|
||||
FILE _cleanup_fclose_ *ours = NULL;
|
||||
_cleanup_free_ char *section = NULL, *continuation = NULL;
|
||||
_cleanup_fclose_ FILE *ours = NULL;
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
|
|
|
@ -44,7 +44,7 @@ typedef struct EpollData {
|
|||
} EpollData;
|
||||
|
||||
static dbus_bool_t add_watch(DBusWatch *watch, void *data) {
|
||||
EpollData _cleanup_free_ *e = NULL;
|
||||
_cleanup_free_ EpollData *e = NULL;
|
||||
struct epoll_event ev = {};
|
||||
|
||||
assert(watch);
|
||||
|
@ -89,7 +89,7 @@ static dbus_bool_t add_watch(DBusWatch *watch, void *data) {
|
|||
}
|
||||
|
||||
static void remove_watch(DBusWatch *watch, void *data) {
|
||||
EpollData _cleanup_free_ *e = NULL;
|
||||
_cleanup_free_ EpollData *e = NULL;
|
||||
|
||||
assert(watch);
|
||||
|
||||
|
@ -175,7 +175,7 @@ fail:
|
|||
}
|
||||
|
||||
static void remove_timeout(DBusTimeout *timeout, void *data) {
|
||||
EpollData _cleanup_free_ *e = NULL;
|
||||
_cleanup_free_ EpollData *e = NULL;
|
||||
|
||||
assert(timeout);
|
||||
|
||||
|
|
|
@ -544,8 +544,8 @@ static void write_env_var(FILE *f, const char *v) {
|
|||
|
||||
int write_env_file(const char *fname, char **l) {
|
||||
char **i;
|
||||
char _cleanup_free_ *p = NULL;
|
||||
FILE _cleanup_fclose_ *f = NULL;
|
||||
_cleanup_free_ char *p = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
int r;
|
||||
|
||||
r = fopen_temporary(fname, &f, &p);
|
||||
|
|
|
@ -163,7 +163,7 @@ int hwclock_set_time(const struct tm *tm) {
|
|||
}
|
||||
|
||||
int hwclock_is_localtime(void) {
|
||||
FILE _cleanup_fclose_ *f;
|
||||
_cleanup_fclose_ FILE *f;
|
||||
|
||||
/*
|
||||
* The third line of adjtime is "UTC" or "LOCAL" or nothing.
|
||||
|
|
|
@ -60,7 +60,7 @@ static char *specifier_instance(char specifier, void *data, void *userdata) {
|
|||
static char *specifier_user_name(char specifier, void *data, void *userdata) {
|
||||
InstallInfo *i = userdata;
|
||||
const char *username;
|
||||
char _cleanup_free_ *tmp = NULL;
|
||||
_cleanup_free_ char *tmp = NULL;
|
||||
char *printed = NULL;
|
||||
|
||||
assert(i);
|
||||
|
|
|
@ -198,7 +198,7 @@ static int remove_marked_symlinks_fd(
|
|||
char** files) {
|
||||
|
||||
int r = 0;
|
||||
DIR _cleanup_closedir_ *d = NULL;
|
||||
_cleanup_closedir_ DIR *d = NULL;
|
||||
|
||||
assert(remove_symlinks_to);
|
||||
assert(fd >= 0);
|
||||
|
@ -235,7 +235,7 @@ static int remove_marked_symlinks_fd(
|
|||
|
||||
if (de->d_type == DT_DIR) {
|
||||
int nfd, q;
|
||||
char _cleanup_free_ *p = NULL;
|
||||
_cleanup_free_ char *p = NULL;
|
||||
|
||||
nfd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW);
|
||||
if (nfd < 0) {
|
||||
|
@ -260,7 +260,7 @@ static int remove_marked_symlinks_fd(
|
|||
r = q;
|
||||
|
||||
} else if (de->d_type == DT_LNK) {
|
||||
char _cleanup_free_ *p = NULL, *dest = NULL;
|
||||
_cleanup_free_ char *p = NULL, *dest = NULL;
|
||||
int q;
|
||||
bool found;
|
||||
|
||||
|
@ -362,7 +362,7 @@ static int find_symlinks_fd(
|
|||
bool *same_name_link) {
|
||||
|
||||
int r = 0;
|
||||
DIR _cleanup_closedir_ *d = NULL;
|
||||
_cleanup_closedir_ DIR *d = NULL;
|
||||
|
||||
assert(name);
|
||||
assert(fd >= 0);
|
||||
|
@ -395,7 +395,7 @@ static int find_symlinks_fd(
|
|||
|
||||
if (de->d_type == DT_DIR) {
|
||||
int nfd, q;
|
||||
char _cleanup_free_ *p = NULL;
|
||||
_cleanup_free_ char *p = NULL;
|
||||
|
||||
nfd = openat(fd, de->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW);
|
||||
if (nfd < 0) {
|
||||
|
@ -423,7 +423,7 @@ static int find_symlinks_fd(
|
|||
r = q;
|
||||
|
||||
} else if (de->d_type == DT_LNK) {
|
||||
char _cleanup_free_ *p = NULL, *dest = NULL;
|
||||
_cleanup_free_ char *p = NULL, *dest = NULL;
|
||||
bool found_path, found_dest, b = false;
|
||||
int q;
|
||||
|
||||
|
@ -458,7 +458,7 @@ static int find_symlinks_fd(
|
|||
found_dest = streq(path_get_file_name(dest), name);
|
||||
|
||||
if (found_path && found_dest) {
|
||||
char _cleanup_free_ *t = NULL;
|
||||
_cleanup_free_ char *t = NULL;
|
||||
|
||||
/* Filter out same name links in the main
|
||||
* config path */
|
||||
|
@ -508,7 +508,7 @@ static int find_symlinks_in_scope(
|
|||
UnitFileState *state) {
|
||||
|
||||
int r;
|
||||
char _cleanup_free_ *path = NULL;
|
||||
_cleanup_free_ char *path = NULL;
|
||||
bool same_name_link_runtime = false, same_name_link = false;
|
||||
|
||||
assert(scope >= 0);
|
||||
|
@ -567,7 +567,7 @@ int unit_file_mask(
|
|||
unsigned *n_changes) {
|
||||
|
||||
char **i;
|
||||
char _cleanup_free_ *prefix;
|
||||
_cleanup_free_ char *prefix;
|
||||
int r;
|
||||
|
||||
assert(scope >= 0);
|
||||
|
@ -578,7 +578,7 @@ int unit_file_mask(
|
|||
return r;
|
||||
|
||||
STRV_FOREACH(i, files) {
|
||||
char _cleanup_free_ *path = NULL;
|
||||
_cleanup_free_ char *path = NULL;
|
||||
|
||||
if (!unit_name_is_valid(*i, true)) {
|
||||
if (r == 0)
|
||||
|
@ -700,9 +700,9 @@ int unit_file_link(
|
|||
UnitFileChange **changes,
|
||||
unsigned *n_changes) {
|
||||
|
||||
LookupPaths _cleanup_lookup_paths_free_ paths = {};
|
||||
_cleanup_lookup_paths_free_ LookupPaths paths = {};
|
||||
char **i;
|
||||
char _cleanup_free_ *config_path = NULL;
|
||||
_cleanup_free_ char *config_path = NULL;
|
||||
int r, q;
|
||||
|
||||
assert(scope >= 0);
|
||||
|
@ -717,7 +717,7 @@ int unit_file_link(
|
|||
return r;
|
||||
|
||||
STRV_FOREACH(i, files) {
|
||||
char _cleanup_free_ *path = NULL;
|
||||
_cleanup_free_ char *path = NULL;
|
||||
char *fn;
|
||||
struct stat st;
|
||||
|
||||
|
@ -758,7 +758,7 @@ int unit_file_link(
|
|||
}
|
||||
|
||||
if (errno == EEXIST) {
|
||||
char _cleanup_free_ *dest = NULL;
|
||||
_cleanup_free_ char *dest = NULL;
|
||||
|
||||
q = readlink_and_make_absolute(path, &dest);
|
||||
|
||||
|
@ -941,7 +941,7 @@ static int config_parse_also(const char *unit,
|
|||
assert(rvalue);
|
||||
|
||||
FOREACH_WORD_QUOTED(w, l, rvalue, state) {
|
||||
char _cleanup_free_ *n;
|
||||
_cleanup_free_ char *n;
|
||||
int r;
|
||||
|
||||
n = strndup(w, l);
|
||||
|
@ -999,7 +999,7 @@ static int unit_file_load(
|
|||
};
|
||||
|
||||
int fd;
|
||||
FILE _cleanup_fclose_ *f = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
int r;
|
||||
|
||||
assert(c);
|
||||
|
@ -1117,7 +1117,7 @@ static int unit_file_can_install(
|
|||
const char *name,
|
||||
bool allow_symlink) {
|
||||
|
||||
InstallContext _cleanup_install_context_done_ c = {};
|
||||
_cleanup_install_context_done_ InstallContext c = {};
|
||||
InstallInfo *i;
|
||||
int r;
|
||||
|
||||
|
@ -1148,7 +1148,7 @@ static int create_symlink(
|
|||
UnitFileChange **changes,
|
||||
unsigned *n_changes) {
|
||||
|
||||
char _cleanup_free_ *dest = NULL;
|
||||
_cleanup_free_ char *dest = NULL;
|
||||
int r;
|
||||
|
||||
assert(old_path);
|
||||
|
@ -1199,7 +1199,7 @@ static int install_info_symlink_alias(
|
|||
assert(config_path);
|
||||
|
||||
STRV_FOREACH(s, i->aliases) {
|
||||
char _cleanup_free_ *alias_path = NULL, *dst = NULL;
|
||||
_cleanup_free_ char *alias_path = NULL, *dst = NULL;
|
||||
|
||||
dst = install_full_printf(i, *s);
|
||||
if (!dst)
|
||||
|
@ -1231,7 +1231,7 @@ static int install_info_symlink_wants(
|
|||
assert(config_path);
|
||||
|
||||
STRV_FOREACH(s, i->wanted_by) {
|
||||
char _cleanup_free_ *path = NULL, *dst = NULL;
|
||||
_cleanup_free_ char *path = NULL, *dst = NULL;
|
||||
|
||||
dst = install_full_printf(i, *s);
|
||||
if (!dst)
|
||||
|
@ -1268,7 +1268,7 @@ static int install_info_symlink_requires(
|
|||
assert(config_path);
|
||||
|
||||
STRV_FOREACH(s, i->required_by) {
|
||||
char _cleanup_free_ *path = NULL, *dst = NULL;
|
||||
_cleanup_free_ char *path = NULL, *dst = NULL;
|
||||
|
||||
dst = install_full_printf(i, *s);
|
||||
if (!dst)
|
||||
|
@ -1300,7 +1300,7 @@ static int install_info_symlink_link(
|
|||
unsigned *n_changes) {
|
||||
|
||||
int r;
|
||||
char _cleanup_free_ *path = NULL;
|
||||
_cleanup_free_ char *path = NULL;
|
||||
|
||||
assert(i);
|
||||
assert(paths);
|
||||
|
@ -1453,10 +1453,10 @@ int unit_file_enable(
|
|||
UnitFileChange **changes,
|
||||
unsigned *n_changes) {
|
||||
|
||||
LookupPaths _cleanup_lookup_paths_free_ paths = {};
|
||||
InstallContext _cleanup_install_context_done_ c = {};
|
||||
_cleanup_lookup_paths_free_ LookupPaths paths = {};
|
||||
_cleanup_install_context_done_ InstallContext c = {};
|
||||
char **i;
|
||||
char _cleanup_free_ *config_path = NULL;
|
||||
_cleanup_free_ char *config_path = NULL;
|
||||
int r;
|
||||
|
||||
assert(scope >= 0);
|
||||
|
@ -1492,11 +1492,11 @@ int unit_file_disable(
|
|||
UnitFileChange **changes,
|
||||
unsigned *n_changes) {
|
||||
|
||||
LookupPaths _cleanup_lookup_paths_free_ paths = {};
|
||||
InstallContext _cleanup_install_context_done_ c = {};
|
||||
_cleanup_lookup_paths_free_ LookupPaths paths = {};
|
||||
_cleanup_install_context_done_ InstallContext c = {};
|
||||
char **i;
|
||||
char _cleanup_free_ *config_path = NULL;
|
||||
Set _cleanup_set_free_free_ *remove_symlinks_to = NULL;
|
||||
_cleanup_free_ char *config_path = NULL;
|
||||
_cleanup_set_free_free_ Set *remove_symlinks_to = NULL;
|
||||
int r, q;
|
||||
|
||||
assert(scope >= 0);
|
||||
|
@ -1534,11 +1534,11 @@ int unit_file_reenable(
|
|||
UnitFileChange **changes,
|
||||
unsigned *n_changes) {
|
||||
|
||||
LookupPaths _cleanup_lookup_paths_free_ paths = {};
|
||||
InstallContext _cleanup_install_context_done_ c = {};
|
||||
_cleanup_lookup_paths_free_ LookupPaths paths = {};
|
||||
_cleanup_install_context_done_ InstallContext c = {};
|
||||
char **i;
|
||||
char _cleanup_free_ *config_path = NULL;
|
||||
Set _cleanup_set_free_free_ *remove_symlinks_to = NULL;
|
||||
_cleanup_free_ char *config_path = NULL;
|
||||
_cleanup_set_free_free_ Set *remove_symlinks_to = NULL;
|
||||
int r, q;
|
||||
|
||||
assert(scope >= 0);
|
||||
|
@ -1577,10 +1577,10 @@ UnitFileState unit_file_get_state(
|
|||
const char *root_dir,
|
||||
const char *name) {
|
||||
|
||||
LookupPaths _cleanup_lookup_paths_free_ paths = {};
|
||||
_cleanup_lookup_paths_free_ LookupPaths paths = {};
|
||||
UnitFileState state = _UNIT_FILE_STATE_INVALID;
|
||||
char **i;
|
||||
char _cleanup_free_ *path = NULL;
|
||||
_cleanup_free_ char *path = NULL;
|
||||
int r;
|
||||
|
||||
assert(scope >= 0);
|
||||
|
@ -1650,7 +1650,7 @@ UnitFileState unit_file_get_state(
|
|||
}
|
||||
|
||||
int unit_file_query_preset(UnitFileScope scope, const char *name) {
|
||||
char _cleanup_strv_free_ **files = NULL;
|
||||
_cleanup_strv_free_ char **files = NULL;
|
||||
char **i;
|
||||
int r;
|
||||
|
||||
|
@ -1680,7 +1680,7 @@ int unit_file_query_preset(UnitFileScope scope, const char *name) {
|
|||
return r;
|
||||
|
||||
STRV_FOREACH(i, files) {
|
||||
FILE _cleanup_fclose_ *f;
|
||||
_cleanup_fclose_ FILE *f;
|
||||
|
||||
f = fopen(*i, "re");
|
||||
if (!f) {
|
||||
|
@ -1735,11 +1735,11 @@ int unit_file_preset(
|
|||
UnitFileChange **changes,
|
||||
unsigned *n_changes) {
|
||||
|
||||
LookupPaths _cleanup_lookup_paths_free_ paths = {};
|
||||
InstallContext _cleanup_install_context_done_ plus = {}, minus = {};
|
||||
_cleanup_lookup_paths_free_ LookupPaths paths = {};
|
||||
_cleanup_install_context_done_ InstallContext plus = {}, minus = {};
|
||||
char **i;
|
||||
char _cleanup_free_ *config_path = NULL;
|
||||
Set _cleanup_set_free_free_ *remove_symlinks_to = NULL;
|
||||
_cleanup_free_ char *config_path = NULL;
|
||||
_cleanup_set_free_free_ Set *remove_symlinks_to = NULL;
|
||||
int r, q;
|
||||
|
||||
assert(scope >= 0);
|
||||
|
@ -1801,10 +1801,10 @@ int unit_file_get_list(
|
|||
const char *root_dir,
|
||||
Hashmap *h) {
|
||||
|
||||
LookupPaths _cleanup_lookup_paths_free_ paths = {};
|
||||
_cleanup_lookup_paths_free_ LookupPaths paths = {};
|
||||
char **i;
|
||||
char _cleanup_free_ *buf = NULL;
|
||||
DIR _cleanup_closedir_ *d = NULL;
|
||||
_cleanup_free_ char *buf = NULL;
|
||||
_cleanup_closedir_ DIR *d = NULL;
|
||||
int r;
|
||||
|
||||
assert(scope >= 0);
|
||||
|
|
|
@ -278,7 +278,7 @@ static int output_short(
|
|||
} else if ((flags & OUTPUT_FULL_WIDTH) || (message_len + n + 1 < n_columns))
|
||||
fprintf(f, ": %s%.*s%s\n", color_on, (int) message_len, message, color_off);
|
||||
else if (n < n_columns && n_columns - n - 2 >= 3) {
|
||||
char _cleanup_free_ *e;
|
||||
_cleanup_free_ char *e;
|
||||
|
||||
e = ellipsize_mem(message, message_len, n_columns - n - 2, 90);
|
||||
|
||||
|
@ -304,7 +304,7 @@ static int output_verbose(
|
|||
|
||||
const void *data;
|
||||
size_t length;
|
||||
char _cleanup_free_ *cursor = NULL;
|
||||
_cleanup_free_ char *cursor = NULL;
|
||||
uint64_t realtime;
|
||||
char ts[FORMAT_TIMESTAMP_MAX];
|
||||
int r;
|
||||
|
@ -366,7 +366,7 @@ static int output_export(
|
|||
char sid[33];
|
||||
int r;
|
||||
usec_t realtime, monotonic;
|
||||
char _cleanup_free_ *cursor = NULL;
|
||||
_cleanup_free_ char *cursor = NULL;
|
||||
const void *data;
|
||||
size_t length;
|
||||
|
||||
|
@ -495,7 +495,7 @@ static int output_json(
|
|||
OutputFlags flags) {
|
||||
|
||||
uint64_t realtime, monotonic;
|
||||
char _cleanup_free_ *cursor = NULL;
|
||||
_cleanup_free_ char *cursor = NULL;
|
||||
const void *data;
|
||||
size_t length;
|
||||
sd_id128_t boot_id;
|
||||
|
@ -942,7 +942,7 @@ int show_journal_by_unit(
|
|||
OutputFlags flags,
|
||||
bool system) {
|
||||
|
||||
sd_journal _cleanup_journal_close_ *j = NULL;
|
||||
_cleanup_journal_close_ sd_journal*j = NULL;
|
||||
int r;
|
||||
int jflags = SD_JOURNAL_LOCAL_ONLY | system * SD_JOURNAL_SYSTEM_ONLY;
|
||||
|
||||
|
|
|
@ -322,7 +322,7 @@ int lookup_paths_init(
|
|||
strv_uniq(p->unit_path);
|
||||
|
||||
if (!strv_isempty(p->unit_path)) {
|
||||
char _cleanup_free_ *t = strv_join(p->unit_path, "\n\t");
|
||||
_cleanup_free_ char *t = strv_join(p->unit_path, "\n\t");
|
||||
if (!t)
|
||||
return -ENOMEM;
|
||||
log_debug("Looking for unit files in (higher priority first):\n\t%s", t);
|
||||
|
@ -382,7 +382,7 @@ int lookup_paths_init(
|
|||
strv_uniq(p->sysvrcnd_path);
|
||||
|
||||
if (!strv_isempty(p->sysvinit_path)) {
|
||||
char _cleanup_free_ *t = strv_join(p->sysvinit_path, "\n\t");
|
||||
_cleanup_free_ char *t = strv_join(p->sysvinit_path, "\n\t");
|
||||
if (!t)
|
||||
return -ENOMEM;
|
||||
log_debug("Looking for SysV init scripts in:\n\t%s", t);
|
||||
|
@ -393,7 +393,7 @@ int lookup_paths_init(
|
|||
}
|
||||
|
||||
if (!strv_isempty(p->sysvrcnd_path)) {
|
||||
char _cleanup_free_ *t =
|
||||
_cleanup_free_ char *t =
|
||||
strv_join(p->sysvrcnd_path, "\n\t");
|
||||
if (!t)
|
||||
return -ENOMEM;
|
||||
|
|
|
@ -364,7 +364,7 @@ int socket_address_print(const SocketAddress *a, char **p) {
|
|||
}
|
||||
|
||||
case AF_NETLINK: {
|
||||
char _cleanup_free_ *sfamily = NULL;
|
||||
_cleanup_free_ char *sfamily = NULL;
|
||||
|
||||
r = netlink_family_to_string_alloc(a->protocol, &sfamily);
|
||||
if (r < 0)
|
||||
|
@ -568,7 +568,7 @@ bool socket_address_matches_fd(const SocketAddress *a, int fd) {
|
|||
int make_socket_fd(const char* address, int flags) {
|
||||
SocketAddress a;
|
||||
int fd, r;
|
||||
char _cleanup_free_ *p = NULL;
|
||||
_cleanup_free_ char *p = NULL;
|
||||
|
||||
r = socket_address_parse(&a, address);
|
||||
if (r < 0) {
|
||||
|
|
|
@ -2080,7 +2080,7 @@ int release_terminal(void) {
|
|||
.sa_handler = SIG_IGN,
|
||||
.sa_flags = SA_RESTART,
|
||||
};
|
||||
int _cleanup_close_ fd;
|
||||
_cleanup_close_ int fd;
|
||||
|
||||
fd = open("/dev/tty", O_RDWR|O_NOCTTY|O_NDELAY|O_CLOEXEC);
|
||||
if (fd < 0)
|
||||
|
@ -4344,7 +4344,7 @@ int in_group(const char *name) {
|
|||
}
|
||||
|
||||
int glob_exists(const char *path) {
|
||||
glob_t _cleanup_globfree_ g = {};
|
||||
_cleanup_globfree_ glob_t g = {};
|
||||
int r, k;
|
||||
|
||||
assert(path);
|
||||
|
|
|
@ -287,7 +287,7 @@ int utmp_put_runlevel(int runlevel, int previous) {
|
|||
#define TIMEOUT_MSEC 50
|
||||
|
||||
static int write_to_terminal(const char *tty, const char *message) {
|
||||
int _cleanup_close_ fd = -1;
|
||||
_cleanup_close_ int fd = -1;
|
||||
const char *p;
|
||||
size_t left;
|
||||
usec_t end;
|
||||
|
|
|
@ -168,7 +168,7 @@ int detect_vm(const char **id) {
|
|||
}
|
||||
|
||||
int detect_container(const char **id) {
|
||||
char _cleanup_free_ *e = NULL;
|
||||
_cleanup_free_ char *e = NULL;
|
||||
int r;
|
||||
|
||||
/* Unfortunately many of these operations require root access
|
||||
|
|
|
@ -353,7 +353,7 @@ static void output_units_list(const struct unit_info *unit_infos, unsigned c) {
|
|||
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 = "";
|
||||
|
||||
|
@ -495,7 +495,7 @@ static int get_triggered_units(DBusConnection *bus, const char* unit_path,
|
|||
{
|
||||
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;
|
||||
|
||||
|
@ -546,7 +546,7 @@ static int get_listening(DBusConnection *bus, const char* unit_path,
|
|||
{
|
||||
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;
|
||||
|
||||
|
@ -702,7 +702,7 @@ static int list_sockets(DBusConnection *bus, char **args) {
|
|||
|
||||
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))
|
||||
|
@ -808,7 +808,7 @@ static void output_unit_file_list(const UnitFileList *units, unsigned c) {
|
|||
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;
|
||||
|
||||
|
@ -1092,7 +1092,7 @@ static int list_dependencies_compare(const void *_a, const void *_b) {
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -1197,7 +1197,7 @@ static void list_jobs_print(struct job_info* jobs, size_t n) {
|
|||
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);
|
||||
|
@ -1439,7 +1439,7 @@ typedef struct WaitData {
|
|||
} 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);
|
||||
|
@ -1675,7 +1675,7 @@ static void check_triggering_units(
|
|||
*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;
|
||||
|
||||
|
@ -1889,8 +1889,8 @@ static int start_unit(DBusConnection *bus, char **args) {
|
|||
|
||||
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);
|
||||
|
@ -2916,7 +2916,7 @@ static void show_unit_help(UnitStatusInfo *i) {
|
|||
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;
|
||||
|
||||
|
@ -3361,7 +3361,7 @@ static int print_property(const char *name, DBusMessageIter *iter) {
|
|||
|
||||
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, " ");
|
||||
|
||||
|
@ -3401,7 +3401,7 @@ static int print_property(const char *name, DBusMessageIter *iter) {
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -3494,7 +3494,7 @@ static int show_one(const char *verb, DBusConnection *bus, const char *path, boo
|
|||
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);
|
||||
|
@ -3537,7 +3537,7 @@ static int show_all(const char* verb, DBusConnection *bus, bool show_properties,
|
|||
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;
|
||||
|
@ -4009,7 +4009,7 @@ static int enable_sysv_units(char **args) {
|
|||
r = 0;
|
||||
for (f = 1; args[f]; f++) {
|
||||
const char *name;
|
||||
char _cleanup_free_ *p = NULL, *q = NULL;
|
||||
_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 };
|
||||
|
@ -4181,10 +4181,10 @@ static int enable_unit(DBusConnection *bus, char **args) {
|
|||
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);
|
||||
|
||||
|
@ -4380,9 +4380,9 @@ finish:
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -4760,7 +4760,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
|
|||
size_t size;
|
||||
|
||||
FOREACH_WORD_SEPARATOR(word, size, optarg, ",", state) {
|
||||
char _cleanup_free_ *type;
|
||||
_cleanup_free_ char *type;
|
||||
|
||||
type = strndup(word, size);
|
||||
if (!type)
|
||||
|
@ -5400,8 +5400,8 @@ static int action_to_runlevel(void) {
|
|||
}
|
||||
|
||||
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",
|
||||
|
@ -5490,7 +5490,7 @@ finish:
|
|||
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();
|
||||
|
@ -5693,7 +5693,7 @@ static int systemctl_main(DBusConnection *bus, int argc, char *argv[], DBusError
|
|||
}
|
||||
|
||||
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,
|
||||
|
@ -5835,7 +5835,7 @@ static int halt_main(DBusConnection *bus) {
|
|||
}
|
||||
|
||||
if (arg_when > 0) {
|
||||
char _cleanup_free_ *m;
|
||||
_cleanup_free_ char *m;
|
||||
|
||||
m = strv_join(arg_wall, " ");
|
||||
r = send_shutdownd(arg_when,
|
||||
|
@ -5898,7 +5898,7 @@ static int runlevel_main(void) {
|
|||
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);
|
||||
|
||||
|
|
|
@ -211,11 +211,11 @@ static void test_config_parse_exec(void) {
|
|||
|
||||
|
||||
static void test_load_env_file_1(void) {
|
||||
char _cleanup_strv_free_ **data = NULL;
|
||||
_cleanup_strv_free_ char **data = NULL;
|
||||
int r;
|
||||
|
||||
char name[] = "/tmp/test-load-env-file.XXXXXX";
|
||||
int _cleanup_close_ fd = mkstemp(name);
|
||||
_cleanup_close_ int fd = mkstemp(name);
|
||||
assert(fd >= 0);
|
||||
assert_se(write(fd, env_file_1, sizeof(env_file_1)) == sizeof(env_file_1));
|
||||
|
||||
|
@ -232,11 +232,11 @@ static void test_load_env_file_1(void) {
|
|||
}
|
||||
|
||||
static void test_load_env_file_2(void) {
|
||||
char _cleanup_strv_free_ **data = NULL;
|
||||
_cleanup_strv_free_ char **data = NULL;
|
||||
int r;
|
||||
|
||||
char name[] = "/tmp/test-load-env-file.XXXXXX";
|
||||
int _cleanup_close_ fd = mkstemp(name);
|
||||
_cleanup_close_ int fd = mkstemp(name);
|
||||
assert(fd >= 0);
|
||||
assert_se(write(fd, env_file_2, sizeof(env_file_2)) == sizeof(env_file_2));
|
||||
|
||||
|
@ -248,11 +248,11 @@ static void test_load_env_file_2(void) {
|
|||
}
|
||||
|
||||
static void test_load_env_file_3(void) {
|
||||
char _cleanup_strv_free_ **data = NULL;
|
||||
_cleanup_strv_free_ char **data = NULL;
|
||||
int r;
|
||||
|
||||
char name[] = "/tmp/test-load-env-file.XXXXXX";
|
||||
int _cleanup_close_ fd = mkstemp(name);
|
||||
_cleanup_close_ int fd = mkstemp(name);
|
||||
assert(fd >= 0);
|
||||
assert_se(write(fd, env_file_3, sizeof(env_file_3)) == sizeof(env_file_3));
|
||||
|
||||
|
@ -263,11 +263,11 @@ static void test_load_env_file_3(void) {
|
|||
}
|
||||
|
||||
static void test_load_env_file_4(void) {
|
||||
char _cleanup_strv_free_ **data = NULL;
|
||||
_cleanup_strv_free_ char **data = NULL;
|
||||
int r;
|
||||
|
||||
char name[] = "/tmp/test-load-env-file.XXXXXX";
|
||||
int _cleanup_close_ fd = mkstemp(name);
|
||||
_cleanup_close_ int fd = mkstemp(name);
|
||||
assert(fd >= 0);
|
||||
assert_se(write(fd, env_file_4, sizeof(env_file_4)) == sizeof(env_file_4));
|
||||
|
||||
|
@ -295,7 +295,7 @@ static void test_install_printf(void) {
|
|||
InstallInfo i3 = {name3, path3, user};
|
||||
InstallInfo i4 = {name3, path3, NULL};
|
||||
|
||||
char _cleanup_free_ *mid, *bid, *host;
|
||||
_cleanup_free_ char *mid, *bid, *host;
|
||||
|
||||
assert_se((mid = specifier_machine_id('m', NULL, NULL)));
|
||||
assert_se((bid = specifier_boot_id('b', NULL, NULL)));
|
||||
|
@ -303,8 +303,8 @@ static void test_install_printf(void) {
|
|||
|
||||
#define expect(src, pattern, result) \
|
||||
do { \
|
||||
char _cleanup_free_ *t = install_full_printf(&src, pattern); \
|
||||
char _cleanup_free_ \
|
||||
_cleanup_free_ char *t = install_full_printf(&src, pattern); \
|
||||
_cleanup_free_ char \
|
||||
*d1 = strdup(i.name), \
|
||||
*d2 = strdup(i.path), \
|
||||
*d3 = strdup(i.user); \
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
static void test_replacements(void) {
|
||||
#define expect(pattern, repl, expected) \
|
||||
{ \
|
||||
char _cleanup_free_ *t = \
|
||||
_cleanup_free_ char *t = \
|
||||
unit_name_replace_instance(pattern, repl); \
|
||||
puts(t); \
|
||||
assert(streq(t, expected)); \
|
||||
|
@ -57,7 +57,7 @@ static void test_replacements(void) {
|
|||
#undef expect
|
||||
#define expect(path, suffix, expected) \
|
||||
{ \
|
||||
char _cleanup_free_ *k, *t = \
|
||||
_cleanup_free_ char *k, *t = \
|
||||
unit_name_from_path(path, suffix); \
|
||||
puts(t); \
|
||||
k = unit_name_to_path(t); \
|
||||
|
@ -75,7 +75,7 @@ static void test_replacements(void) {
|
|||
#undef expect
|
||||
#define expect(pattern, path, suffix, expected) \
|
||||
{ \
|
||||
char _cleanup_free_ *t = \
|
||||
_cleanup_free_ char *t = \
|
||||
unit_name_from_path_instance(pattern, path, suffix); \
|
||||
puts(t); \
|
||||
assert(streq(t, expected)); \
|
||||
|
@ -90,7 +90,7 @@ static void test_replacements(void) {
|
|||
#undef expect
|
||||
#define expect(pattern) \
|
||||
{ \
|
||||
char _cleanup_free_ *k, *t; \
|
||||
_cleanup_free_ char *k, *t; \
|
||||
assert_se(t = unit_name_mangle(pattern)); \
|
||||
assert_se(k = unit_name_mangle(t)); \
|
||||
puts(t); \
|
||||
|
@ -113,7 +113,7 @@ static int test_unit_printf(void) {
|
|||
Unit *u, *u2;
|
||||
int r;
|
||||
|
||||
char _cleanup_free_ *mid, *bid, *host, *root_uid;
|
||||
_cleanup_free_ char *mid, *bid, *host, *root_uid;
|
||||
struct passwd *root;
|
||||
|
||||
assert_se((mid = specifier_machine_id('m', NULL, NULL)));
|
||||
|
@ -133,7 +133,7 @@ static int test_unit_printf(void) {
|
|||
#define expect(unit, pattern, expected) \
|
||||
{ \
|
||||
char *e; \
|
||||
char _cleanup_free_ *t = \
|
||||
_cleanup_free_ char *t = \
|
||||
unit_full_printf(unit, pattern); \
|
||||
printf("result: %s\nexpect: %s\n", t, expected); \
|
||||
if ((e = endswith(expected, "*"))) \
|
||||
|
|
|
@ -218,7 +218,7 @@ static int write_data_timezone(void) {
|
|||
|
||||
static int write_data_local_rtc(void) {
|
||||
int r;
|
||||
char _cleanup_free_ *s = NULL, *w = NULL;
|
||||
_cleanup_free_ char *s = NULL, *w = NULL;
|
||||
|
||||
r = read_full_file("/etc/adjtime", &s, NULL);
|
||||
if (r < 0) {
|
||||
|
@ -270,7 +270,7 @@ static int write_data_local_rtc(void) {
|
|||
}
|
||||
|
||||
static char** get_ntp_services(void) {
|
||||
char _cleanup_strv_free_ **r = NULL, **files;
|
||||
_cleanup_strv_free_ char **r = NULL, **files;
|
||||
char **i;
|
||||
int k;
|
||||
|
||||
|
@ -284,7 +284,7 @@ static char** get_ntp_services(void) {
|
|||
return NULL;
|
||||
|
||||
STRV_FOREACH(i, files) {
|
||||
FILE _cleanup_fclose_ *f;
|
||||
_cleanup_fclose_ FILE *f;
|
||||
|
||||
f = fopen(*i, "re");
|
||||
if (!f)
|
||||
|
|
|
@ -135,7 +135,7 @@ static struct Item* find_glob(Hashmap *h, const char *match) {
|
|||
}
|
||||
|
||||
static void load_unix_sockets(void) {
|
||||
FILE _cleanup_fclose_ *f = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
char line[LINE_MAX];
|
||||
|
||||
if (unix_sockets)
|
||||
|
@ -269,7 +269,7 @@ static int dir_cleanup(
|
|||
while ((dent = readdir(d))) {
|
||||
struct stat s;
|
||||
usec_t age;
|
||||
char _cleanup_free_ *sub_path = NULL;
|
||||
_cleanup_free_ char *sub_path = NULL;
|
||||
|
||||
if (streq(dent->d_name, ".") ||
|
||||
streq(dent->d_name, ".."))
|
||||
|
@ -321,7 +321,7 @@ static int dir_cleanup(
|
|||
if (maxdepth <= 0)
|
||||
log_warning("Reached max depth on %s.", sub_path);
|
||||
else {
|
||||
DIR _cleanup_closedir_ *sub_dir;
|
||||
_cleanup_closedir_ DIR *sub_dir;
|
||||
int q;
|
||||
|
||||
sub_dir = xopendirat(dirfd(d), dent->d_name, O_NOFOLLOW|O_NOATIME);
|
||||
|
@ -515,7 +515,7 @@ static int write_one_file(Item *i, const char *path) {
|
|||
}
|
||||
|
||||
static int recursive_relabel_children(Item *i, const char *path) {
|
||||
DIR _cleanup_closedir_ *d;
|
||||
_cleanup_closedir_ DIR *d;
|
||||
int ret = 0;
|
||||
|
||||
/* This returns the first error we run into, but nevertheless
|
||||
|
@ -530,7 +530,7 @@ static int recursive_relabel_children(Item *i, const char *path) {
|
|||
union dirent_storage buf;
|
||||
bool is_dir;
|
||||
int r;
|
||||
char _cleanup_free_ *entry_path = NULL;
|
||||
_cleanup_free_ char *entry_path = NULL;
|
||||
|
||||
r = readdir_r(d, &buf.de, &de);
|
||||
if (r != 0) {
|
||||
|
@ -601,7 +601,7 @@ static int recursive_relabel(Item *i, const char *path) {
|
|||
|
||||
static int glob_item(Item *i, int (*action)(Item *, const char *)) {
|
||||
int r = 0, k;
|
||||
glob_t _cleanup_globfree_ g = {};
|
||||
_cleanup_globfree_ glob_t g = {};
|
||||
char **fn;
|
||||
|
||||
errno = 0;
|
||||
|
@ -879,7 +879,7 @@ static int remove_item(Item *i) {
|
|||
}
|
||||
|
||||
static int clean_item_instance(Item *i, const char* instance) {
|
||||
DIR _cleanup_closedir_ *d = NULL;
|
||||
_cleanup_closedir_ DIR *d = NULL;
|
||||
struct stat s, ps;
|
||||
bool mountpoint;
|
||||
int r;
|
||||
|
@ -1017,9 +1017,9 @@ static bool item_equal(Item *a, Item *b) {
|
|||
}
|
||||
|
||||
static int parse_line(const char *fname, unsigned line, const char *buffer) {
|
||||
Item _cleanup_free_ *i = NULL;
|
||||
_cleanup_free_ Item *i = NULL;
|
||||
Item *existing;
|
||||
char _cleanup_free_
|
||||
_cleanup_free_ char
|
||||
*mode = NULL, *user = NULL, *group = NULL, *age = NULL;
|
||||
char type;
|
||||
Hashmap *h;
|
||||
|
|
|
@ -187,7 +187,7 @@ static void test_orientation(struct udev *udev,
|
|||
const char *devpath)
|
||||
{
|
||||
OrientationUp old, new;
|
||||
int _cleanup_close_ fd = -1;
|
||||
_cleanup_close_ int fd = -1;
|
||||
struct input_event ev[64];
|
||||
bool got_syn = false;
|
||||
bool got_x = false, got_y = false, got_z = false;
|
||||
|
|
|
@ -151,8 +151,8 @@ static void set_scsi_type(char *to, const char *from, size_t len)
|
|||
|
||||
static int dev_if_packed_info(struct udev_device *dev, char *ifs_str, size_t len)
|
||||
{
|
||||
char _cleanup_free_ *filename = NULL;
|
||||
int _cleanup_close_ fd = -1;
|
||||
_cleanup_free_ char *filename = NULL;
|
||||
_cleanup_close_ int fd = -1;
|
||||
ssize_t size;
|
||||
unsigned char buf[18 + 65535];
|
||||
int pos = 0;
|
||||
|
|
|
@ -181,9 +181,9 @@ static int trie_insert(struct trie *trie, struct trie_node *node, const char *se
|
|||
struct trie_node *child;
|
||||
|
||||
for (p = 0; (c = trie->strings->buf[node->prefix_off + p]); p++) {
|
||||
char _cleanup_free_ *s = NULL;
|
||||
_cleanup_free_ char *s = NULL;
|
||||
ssize_t off;
|
||||
struct trie_node _cleanup_free_ *new_child = NULL;
|
||||
_cleanup_free_ struct trie_node *new_child = NULL;
|
||||
|
||||
if (c == search[i + p])
|
||||
continue;
|
||||
|
|
|
@ -189,7 +189,7 @@ static void font_copy_to_all_vcs(int fd) {
|
|||
|
||||
for (i = 1; i <= 15; i++) {
|
||||
char vcname[16];
|
||||
int _cleanup_close_ vcfd = -1;
|
||||
_cleanup_close_ int vcfd = -1;
|
||||
struct console_font_op cfo = {};
|
||||
|
||||
if (i == vcs.v_active)
|
||||
|
|
Loading…
Reference in New Issue