chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
socket: add optional libwrap support
[elogind.git]
/
src
/
load-fragment.c
diff --git
a/src/load-fragment.c
b/src/load-fragment.c
index b679fab479a3e29a280a4c6a6bd604fa25780db8..94a637541f54b0fd028accfc3f007e3975fb54a9 100644
(file)
--- 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 (;;) {
* reached by a symlink. The old string will be freed. */
for (;;) {
- char *target, *
k, *
name;
+ char *target, *name;
if (c++ >= FOLLOW_MAX)
return -ELOOP;
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 */
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;
return r;
- k = file_in_same_dir(*filename, target);
- free(target);
-
- if (!k)
- return -ENOMEM;
-
free(*filename);
free(*filename);
- *filename =
k
;
+ *filename =
target
;
}
if (!(f = fdopen(fd, "r"))) {
}
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" },
{ "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" },
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" },
{ "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
{ 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;
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[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;
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;
} 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
/* 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 */
}
/* 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);
goto finish;
free(u->meta.fragment_path);