X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fload-fragment.c;h=94a637541f54b0fd028accfc3f007e3975fb54a9;hb=0213c3f8102bdc934c629d11a44ca0b408762287;hp=b679fab479a3e29a280a4c6a6bd604fa25780db8;hpb=53ec43c61d2f0e19c41640c63ec034b2f8cedb89;p=elogind.git diff --git a/src/load-fragment.c b/src/load-fragment.c index b679fab47..94a637541 100644 --- a/src/load-fragment.c +++ b/src/load-fragment.c @@ -1160,7 +1160,7 @@ static int open_follow(char **filename, FILE **_f, Set *names, char **_final) { * reached by a symlink. The old string will be freed. */ for (;;) { - char *target, *k, *name; + char *target, *name; if (c++ >= FOLLOW_MAX) return -ELOOP; @@ -1189,17 +1189,11 @@ static int open_follow(char **filename, FILE **_f, Set *names, char **_final) { return -errno; /* Hmm, so this is a symlink. Let's read the name, and follow it manually */ - if ((r = readlink_malloc(*filename, &target)) < 0) + if ((r = readlink_and_make_absolute(*filename, &target)) < 0) return r; - k = file_in_same_dir(*filename, target); - free(target); - - if (!k) - return -ENOMEM; - free(*filename); - *filename = k; + *filename = target; } if (!(f = fdopen(fd, "r"))) { @@ -1450,6 +1444,7 @@ static int load_from_path(Unit *u, const char *path) { { "SocketMode", config_parse_mode, &u->socket.socket_mode, "Socket" }, { "KillMode", config_parse_kill_mode, &u->socket.kill_mode, "Socket" }, { "Accept", config_parse_bool, &u->socket.accept, "Socket" }, + { "TCPWrapName", config_parse_string, &u->socket.tcpwrap_name, "Socket" }, EXEC_CONTEXT_CONFIG_ITEMS(u->socket.exec_context, "Socket"), { "What", config_parse_string, &u->mount.parameters_fragment.what, "Mount" }, @@ -1477,12 +1472,17 @@ static int load_from_path(Unit *u, const char *path) { { "DirectoryNotEmpty", config_parse_path_spec, &u->path, "Path" }, { "Unit", config_parse_path_unit, &u->path, "Path" }, + /* The [Install] section is ignored here. */ + { "Alias", NULL, NULL, "Install" }, + { "WantedBy", NULL, NULL, "Install" }, + { "Also", NULL, NULL, "Install" }, + { NULL, NULL, NULL, NULL } }; #undef EXEC_CONTEXT_CONFIG_ITEMS - const char *sections[3]; + const char *sections[4]; int r; Set *symlink_names; FILE *f = NULL; @@ -1500,7 +1500,8 @@ static int load_from_path(Unit *u, const char *path) { sections[0] = "Unit"; sections[1] = section_table[u->meta.type]; - sections[2] = NULL; + sections[2] = "Install"; + sections[3] = NULL; if (!(symlink_names = set_new(string_hash_func, string_compare_func))) return -ENOMEM; @@ -1523,7 +1524,7 @@ static int load_from_path(Unit *u, const char *path) { } else { char **p; - STRV_FOREACH(p, u->meta.manager->unit_path) { + STRV_FOREACH(p, u->meta.manager->lookup_paths.unit_path) { /* Instead of opening the path right away, we manually * follow all symlinks and add their name to our unit @@ -1569,7 +1570,7 @@ static int load_from_path(Unit *u, const char *path) { } /* Now, parse the file contents */ - if ((r = config_parse(filename, f, sections, items, u)) < 0) + if ((r = config_parse(filename, f, sections, items, false, u)) < 0) goto finish; free(u->meta.fragment_path);