path-lookup.c revision 7fd1b19bc9e9f5574f2877936b8ac267c7706947
eef29f7a9e60072b7dc0e4cf5c8bb0ad6fa9ba89Lubos Kosco/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
eef29f7a9e60072b7dc0e4cf5c8bb0ad6fa9ba89Lubos Kosco This file is part of systemd.
eef29f7a9e60072b7dc0e4cf5c8bb0ad6fa9ba89Lubos Kosco Copyright 2010 Lennart Poettering
eef29f7a9e60072b7dc0e4cf5c8bb0ad6fa9ba89Lubos Kosco systemd is free software; you can redistribute it and/or modify it
eef29f7a9e60072b7dc0e4cf5c8bb0ad6fa9ba89Lubos Kosco under the terms of the GNU Lesser General Public License as published by
eef29f7a9e60072b7dc0e4cf5c8bb0ad6fa9ba89Lubos Kosco the Free Software Foundation; either version 2.1 of the License, or
eef29f7a9e60072b7dc0e4cf5c8bb0ad6fa9ba89Lubos Kosco (at your option) any later version.
eef29f7a9e60072b7dc0e4cf5c8bb0ad6fa9ba89Lubos Kosco systemd is distributed in the hope that it will be useful, but
eef29f7a9e60072b7dc0e4cf5c8bb0ad6fa9ba89Lubos Kosco WITHOUT ANY WARRANTY; without even the implied warranty of
eef29f7a9e60072b7dc0e4cf5c8bb0ad6fa9ba89Lubos Kosco MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
eef29f7a9e60072b7dc0e4cf5c8bb0ad6fa9ba89Lubos Kosco Lesser General Public License for more details.
eef29f7a9e60072b7dc0e4cf5c8bb0ad6fa9ba89Lubos Kosco You should have received a copy of the GNU Lesser General Public License
eef29f7a9e60072b7dc0e4cf5c8bb0ad6fa9ba89Lubos Kosco along with systemd; If not, see <http://www.gnu.org/licenses/>.
#include "path-lookup.h"
return -ENOMEM;
*config_home = r;
const char *home;
if (home) {
return -ENOMEM;
*config_home = r;
static char** user_dirs(
const char *generator,
const char *generator_early,
const char *generator_late) {
const char * const config_unit_paths[] = {
const char * const data_unit_paths[] = {
const char *home, *e;
char **r = NULL, **t;
goto fail;
if (!config_dirs)
goto fail;
goto fail;
} else if (home) {
goto fail;
NULL);
if (!data_dirs)
goto fail;
if (generator_early) {
goto fail;
strv_free(r);
if (config_home) {
goto fail;
strv_free(r);
goto finish;
strv_free(r);
goto fail;
strv_free(r);
if (generator) {
goto fail;
strv_free(r);
if (data_home) {
goto fail;
strv_free(r);
goto fail;
strv_free(r);
goto fail;
strv_free(r);
if (generator_late) {
goto fail;
strv_free(r);
if (!path_strv_make_absolute_cwd(r))
goto fail;
fail:
strv_free(r);
r = NULL;
goto finish;
int lookup_paths_init(
LookupPaths *p,
bool personal,
const char *generator,
const char *generator_early,
const char *generator_late) {
assert(p);
if (!p->unit_path)
return -ENOMEM;
if (personal)
NULL);
if (!p->unit_path)
return -ENOMEM;
#ifdef HAVE_SPLIT_USR
NULL);
if (!p->unit_path)
return -ENOMEM;
return -ENOMEM;
return -ENOMEM;
#ifdef HAVE_SYSV_COMPAT
if (!p->sysvinit_path)
return -ENOMEM;
NULL);
if (!p->sysvinit_path)
return -ENOMEM;
if (!p->sysvrcnd_path)
return -ENOMEM;
NULL);
if (!p->sysvrcnd_path)
return -ENOMEM;
return -ENOMEM;
return -ENOMEM;
return -ENOMEM;
_cleanup_free_ char *t =
return -ENOMEM;
assert(p);
#ifdef HAVE_SYSV_COMPAT