X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Ftmpfiles%2Ftmpfiles.c;h=e70332ca0635fceab007e3633913297578033655;hb=1640a0b6b05b8ae01abbe5939f86f17a61e7998f;hp=e0b0e94664622306fd95fda4432d52ca68735c15;hpb=c9bc07646100855ff8193e1e62c52b77327e264d;p=elogind.git diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index e0b0e9466..e70332ca0 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -107,6 +107,9 @@ static const char * const conf_file_dirs[] = { "/run/tmpfiles.d", "/usr/local/lib/tmpfiles.d", "/usr/lib/tmpfiles.d", +#ifdef HAVE_SPLIT_USR + "/lib/tmpfiles.d", +#endif NULL }; @@ -257,8 +260,7 @@ static int dir_cleanup( sub_path = NULL; if (asprintf(&sub_path, "%s/%s", p, dent->d_name) < 0) { - log_error("Out of memory"); - r = -ENOMEM; + r = log_oom(); goto finish; } @@ -845,7 +847,7 @@ static int remove_item_instance(Item *i, const char *instance) { case RECURSIVE_REMOVE_PATH: /* FIXME: we probably should use dir_cleanup() here * instead of rm_rf() so that 'x' is honoured. */ - r = rm_rf(instance, false, i->type == RECURSIVE_REMOVE_PATH, false); + r = rm_rf_dangerous(instance, false, i->type == RECURSIVE_REMOVE_PATH, false); if (r < 0 && r != -ENOENT) { log_error("rm_rf(%s): %s", instance, strerror(-r)); return r; @@ -966,10 +968,8 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) { assert(buffer); i = new0(Item, 1); - if (!i) { - log_error("Out of memory"); - return -ENOMEM; - } + if (!i) + return log_oom(); if (sscanf(buffer, "%c " @@ -995,10 +995,8 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) { n += strspn(buffer+n, WHITESPACE); if (buffer[n] != 0 && (buffer[n] != '-' || buffer[n+1] != 0)) { i->argument = unquote(buffer+n, "\""); - if (!i->argument) { - log_error("Out of memory"); - return -ENOMEM; - } + if (!i->argument) + return log_oom(); } } @@ -1076,7 +1074,7 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) { if (user && !streq(user, "-")) { const char *u = user; - r = get_user_creds(&u, &i->uid, NULL, NULL); + r = get_user_creds(&u, &i->uid, NULL, NULL, NULL); if (r < 0) { log_error("[%s:%u] Unknown user '%s'.", fname, line, user); goto finish; @@ -1297,9 +1295,9 @@ static char *resolve_fragment(const char *fragment, const char **search_paths) { return strdup(fragment); STRV_FOREACH(p, search_paths) { - resolved_path = join(*p, "/", fragment, NULL); + resolved_path = strjoin(*p, "/", fragment, NULL); if (resolved_path == NULL) { - log_error("Out of memory"); + log_oom(); return NULL; } @@ -1334,7 +1332,7 @@ int main(int argc, char *argv[]) { globs = hashmap_new(string_hash_func, string_compare_func); if (!items || !globs) { - log_error("Out of memory"); + log_oom(); r = EXIT_FAILURE; goto finish; }