p = line;
for (;;) {
- _cleanup_free_ char *tty = NULL;
- char *path;
+ _cleanup_free_ char *tty = NULL, *path = NULL;
r = extract_first_word(&p, &tty, NULL, 0);
if (r < 0)
return r;
}
- path = strappend("/dev/", tty);
+ path = path_join("/dev", tty);
if (!path)
return -ENOMEM;
if (access(path, F_OK) < 0) {
log_debug_errno(errno, "Console device %s is not accessible, skipping: %m", path);
- free(path);
continue;
}
- r = strv_consume(&l, path);
+ r = strv_consume(&l, TAKE_PTR(path));
if (r < 0)
return r;
}
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path %s is not absolute.", path);
if (!UNIT_WRITE_FLAGS_NOOP(flags)) {
- _cleanup_free_ char *q = NULL;
- char *buf;
+ _cleanup_free_ char *q = NULL, *buf = NULL;
buf = strjoin(b ? "-" : "", path);
if (!buf)
return -ENOMEM;
q = specifier_escape(buf);
- if (!q) {
- free(buf);
+ if (!q)
return -ENOMEM;
- }
fprintf(f, "EnvironmentFile=%s\n", q);
- r = strv_consume(&l, buf);
+ r = strv_consume(&l, TAKE_PTR(buf));
if (r < 0)
return r;
}
}
FOREACH_DIRENT_ALL(de, d, return -errno) {
+ _cleanup_free_ char *u = NULL;
const char *a, *b;
- char *u;
if (de->d_type != DT_UNKNOWN &&
de->d_type != dt)
if (r < 0)
return r;
- if (!http_etag_is_valid(u)) {
- free(u);
+ if (!http_etag_is_valid(u))
continue;
- }
- r = strv_consume(&l, u);
+ r = strv_consume(&l, TAKE_PTR(u));
if (r < 0)
return r;
}
return r;
for (;;) {
- char *pretty = NULL;
+ _cleanup_free_ char *pretty = NULL;
r = read_dns_server_one(m, false, &pretty);
if (r < 0)
if (isempty(pretty))
continue;
- r = strv_consume(l, pretty);
+ r = strv_consume(l, TAKE_PTR(pretty));
if (r < 0)
return r;
}
return r;
for (;;) {
- char *pretty = NULL;
+ _cleanup_free_ char *pretty = NULL;
r = read_domain_one(m, false, &pretty);
if (r < 0)
if (isempty(pretty))
continue;
- r = strv_consume(l, pretty);
+ r = strv_consume(l, TAKE_PTR(pretty));
if (r < 0)
return r;
}
return r;
for (;;) {
- char *pretty = NULL;
+ _cleanup_free_ char *pretty = NULL;
r = read_dns_server_one(m, true, &pretty);
if (r < 0)
if (isempty(pretty))
continue;
- r = strv_consume(l, pretty);
+ r = strv_consume(l, TAKE_PTR(pretty));
if (r < 0)
return r;
}
return r;
for (;;) {
- char *pretty = NULL;
+ _cleanup_free_ char *pretty = NULL;
r = read_domain_one(m, true, &pretty);
if (r < 0)
if (isempty(pretty))
continue;
- r = strv_consume(l, pretty);
+ r = strv_consume(l, TAKE_PTR(pretty));
if (r < 0)
return r;
}