[systemd-commits] 6 commits - man/sd_event_run.xml po/pl.po src/shared src/sysv-generator
Zbigniew Jędrzejewski-Szmek
zbyszek at kemper.freedesktop.org
Sun Apr 12 18:51:03 PDT 2015
man/sd_event_run.xml | 3
po/pl.po | 20 ++
src/shared/hashmap.c | 27 +--
src/sysv-generator/sysv-generator.c | 270 ++++++++++++++++++------------------
4 files changed, 166 insertions(+), 154 deletions(-)
New commits:
commit c268628a20e684d6079de6e5da96c10429e6ed1e
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Sun Apr 12 21:47:58 2015 -0400
man: add link to glib in sd_event_run(3)
diff --git a/man/sd_event_run.xml b/man/sd_event_run.xml
index d9ffe46..ac78d35 100644
--- a/man/sd_event_run.xml
+++ b/man/sd_event_run.xml
@@ -175,7 +175,8 @@
<citerefentry><refentrytitle>sd_event_add_signal</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_event_add_defer</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
<citerefentry><refentrytitle>sd_event_add_exit</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
- <citerefentry><refentrytitle>sd_event_add_post</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
+ <citerefentry><refentrytitle>sd_event_add_post</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
+ <ulink url="https://developer.gnome.org/glib/unstable/glib-The-Main-Event-Loop.html">GLIb Main Event Loop</ulink>.
</para>
</refsect1>
commit 304e64e6385b1b71389d3e5cbb4aab345774ff3f
Author: Piotr Drąg <piotrdrag at gmail.com>
Date: Sun Apr 12 01:45:11 2015 +0200
po: update Polish translation
https://bugs.freedesktop.org/show_bug.cgi?id=89989
diff --git a/po/pl.po b/po/pl.po
index dd748f6..186f1d1 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: systemd\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-03-15 22:59+0100\n"
-"PO-Revision-Date: 2015-03-15 23:00+0100\n"
+"POT-Creation-Date: 2015-04-12 01:40+0200\n"
+"PO-Revision-Date: 2015-04-12 01:44+0200\n"
"Last-Translator: Piotr Drąg <piotrdrag at gmail.com>\n"
"Language-Team: Polish <trans-pl at lists.fedoraproject.org>\n"
"Language: pl\n"
@@ -418,6 +418,18 @@ msgid "Authentication is required to lock or unlock active sessions."
msgstr ""
"Wymagane jest uwierzytelnienie, aby zablokować lub odblokować aktywne sesje."
+#: ../src/login/org.freedesktop.login1.policy.in.h:53
+msgid "Allow indication to the firmware to boot to setup interface"
+msgstr "Wskazanie oprogramowaniu sprzętowemu, aby uruchomić interfejs ustawień"
+
+#: ../src/login/org.freedesktop.login1.policy.in.h:54
+msgid ""
+"Authentication is required to indicate to the firmware to boot to setup "
+"interface."
+msgstr ""
+"Wymagane jest uwierzytelnienie, aby wskazać oprogramowaniu sprzętowemu, że "
+"należy uruchomić interfejs ustawień."
+
#: ../src/machine/org.freedesktop.machine1.policy.in.h:1
msgid "Log into a local container"
msgstr "Logowanie do lokalnego kontenera"
@@ -490,13 +502,13 @@ msgstr ""
"Wymagane jest uwierzytelnienie, aby kontrolować, czy włączyć synchronizację "
"czasu przez sieć."
-#: ../src/fsckd/fsckd.c:291
+#: ../src/fsckd/fsckd.c:297
msgid "Press Ctrl+C to cancel all filesystem checks in progress"
msgstr ""
"Naciśnięcie klawiszy Ctrl+C anuluje wszystkie trwające procesy sprawdzania "
"systemów plików"
-#: ../src/fsckd/fsckd.c:336
+#: ../src/fsckd/fsckd.c:343
#, c-format
msgid "Checking in progress on %d disk (%3.1f%% complete)"
msgid_plural "Checking in progress on %d disks (%3.1f%% complete)"
commit 8fba1c8d4e3d05d2af2848b6570bdc09e725d06e
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Sun Apr 12 16:05:10 2015 -0400
sysv-generator: free memory allocated for service stubs
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index ea32164..5ecd750 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -64,6 +64,8 @@ static const struct {
UP must be read before DOWN */
};
+const char *arg_dest = "/tmp";
+
typedef struct SysvStub {
char *name;
char *path;
@@ -79,7 +81,29 @@ typedef struct SysvStub {
bool reload;
} SysvStub;
-const char *arg_dest = "/tmp";
+static void free_sysvstub(SysvStub *s) {
+ free(s->name);
+ free(s->path);
+ free(s->description);
+ free(s->pid_file);
+ strv_free(s->before);
+ strv_free(s->after);
+ strv_free(s->wants);
+ strv_free(s->wanted_by);
+ strv_free(s->conflicts);
+ free(s);
+}
+
+DEFINE_TRIVIAL_CLEANUP_FUNC(SysvStub*, free_sysvstub);
+
+static void free_sysvstub_hashmapp(Hashmap **h) {
+ SysvStub *stub;
+
+ while ((stub = hashmap_steal_first(*h)))
+ free_sysvstub(stub);
+
+ hashmap_free(*h);
+}
static int add_symlink(const char *service, const char *where) {
_cleanup_free_ char *from = NULL, *to = NULL;
@@ -132,31 +156,17 @@ static int add_alias(const char *service, const char *alias) {
static int generate_unit_file(SysvStub *s) {
char **p;
_cleanup_fclose_ FILE *f = NULL;
- _cleanup_free_ char *unit = NULL;
- _cleanup_free_ char *before = NULL;
- _cleanup_free_ char *after = NULL;
- _cleanup_free_ char *wants = NULL;
- _cleanup_free_ char *conflicts = NULL;
+ _cleanup_free_ char *unit = NULL,
+ *before = NULL, *after = NULL,
+ *wants = NULL, *conflicts = NULL;
int r;
before = strv_join(s->before, " ");
- if (!before)
- return log_oom();
-
after = strv_join(s->after, " ");
- if (!after)
- return log_oom();
-
wants = strv_join(s->wants, " ");
- if (!wants)
- return log_oom();
-
conflicts = strv_join(s->conflicts, " ");
- if (!conflicts)
- return log_oom();
-
unit = strjoin(arg_dest, "/", s->name, NULL);
- if (!unit)
+ if (!before || !after || !wants || !conflicts || !unit)
return log_oom();
/* We might already have a symlink with the same name from a Provides:,
@@ -725,7 +735,7 @@ static int enumerate_sysv(const LookupPaths *lp, Hashmap *all_services) {
while ((de = readdir(d))) {
_cleanup_free_ char *fpath = NULL, *name = NULL;
- _cleanup_free_ SysvStub *service = NULL;
+ _cleanup_(free_sysvstubp) SysvStub *service = NULL;
struct stat st;
int r;
@@ -912,7 +922,7 @@ finish:
int main(int argc, char *argv[]) {
int r, q;
_cleanup_lookup_paths_free_ LookupPaths lp = {};
- Hashmap *all_services;
+ _cleanup_(free_sysvstub_hashmapp) Hashmap *all_services;
SysvStub *service;
Iterator j;
commit 3ef11dcfde7e6c20b0cc37be37704c68433221f9
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Sun Apr 12 16:04:51 2015 -0400
shared/hashmap: normalize whitespace
diff --git a/src/shared/hashmap.c b/src/shared/hashmap.c
index c7512b2..20d599d 100644
--- a/src/shared/hashmap.c
+++ b/src/shared/hashmap.c
@@ -132,10 +132,10 @@ struct swap_entries {
/* Distance from Initial Bucket */
typedef uint8_t dib_raw_t;
-#define DIB_RAW_OVERFLOW ((dib_raw_t)0xfdU) /* indicates DIB value is greater than representable */
-#define DIB_RAW_REHASH ((dib_raw_t)0xfeU) /* entry yet to be rehashed during in-place resize */
-#define DIB_RAW_FREE ((dib_raw_t)0xffU) /* a free bucket */
-#define DIB_RAW_INIT ((char)DIB_RAW_FREE) /* a byte to memset a DIB store with when initializing */
+#define DIB_RAW_OVERFLOW ((dib_raw_t)0xfdU) /* indicates DIB value is greater than representable */
+#define DIB_RAW_REHASH ((dib_raw_t)0xfeU) /* entry yet to be rehashed during in-place resize */
+#define DIB_RAW_FREE ((dib_raw_t)0xffU) /* a free bucket */
+#define DIB_RAW_INIT ((char)DIB_RAW_FREE) /* a byte to memset a DIB store with when initializing */
#define DIB_FREE UINT_MAX
@@ -773,7 +773,7 @@ static void reset_direct_storage(HashmapBase *h) {
memset(p, DIB_RAW_INIT, sizeof(dib_raw_t) * hi->n_direct_buckets);
}
-static struct HashmapBase *hashmap_base_new(const struct hash_ops *hash_ops, enum HashmapType type HASHMAP_DEBUG_PARAMS) {
+static struct HashmapBase *hashmap_base_new(const struct hash_ops *hash_ops, enum HashmapType type HASHMAP_DEBUG_PARAMS) {
HashmapBase *h;
const struct hashmap_type_info *hi = &hashmap_type_info[type];
bool use_pool;
@@ -812,19 +812,19 @@ static struct HashmapBase *hashmap_base_new(const struct hash_ops *hash_ops, enu
}
Hashmap *internal_hashmap_new(const struct hash_ops *hash_ops HASHMAP_DEBUG_PARAMS) {
- return (Hashmap*) hashmap_base_new(hash_ops, HASHMAP_TYPE_PLAIN HASHMAP_DEBUG_PASS_ARGS);
+ return (Hashmap*) hashmap_base_new(hash_ops, HASHMAP_TYPE_PLAIN HASHMAP_DEBUG_PASS_ARGS);
}
OrderedHashmap *internal_ordered_hashmap_new(const struct hash_ops *hash_ops HASHMAP_DEBUG_PARAMS) {
- return (OrderedHashmap*) hashmap_base_new(hash_ops, HASHMAP_TYPE_ORDERED HASHMAP_DEBUG_PASS_ARGS);
+ return (OrderedHashmap*) hashmap_base_new(hash_ops, HASHMAP_TYPE_ORDERED HASHMAP_DEBUG_PASS_ARGS);
}
Set *internal_set_new(const struct hash_ops *hash_ops HASHMAP_DEBUG_PARAMS) {
- return (Set*) hashmap_base_new(hash_ops, HASHMAP_TYPE_SET HASHMAP_DEBUG_PASS_ARGS);
+ return (Set*) hashmap_base_new(hash_ops, HASHMAP_TYPE_SET HASHMAP_DEBUG_PASS_ARGS);
}
static int hashmap_base_ensure_allocated(HashmapBase **h, const struct hash_ops *hash_ops,
- enum HashmapType type HASHMAP_DEBUG_PARAMS) {
+ enum HashmapType type HASHMAP_DEBUG_PARAMS) {
HashmapBase *q;
assert(h);
@@ -832,7 +832,7 @@ static int hashmap_base_ensure_allocated(HashmapBase **h, const struct hash_ops
if (*h)
return 0;
- q = hashmap_base_new(hash_ops, type HASHMAP_DEBUG_PASS_ARGS);
+ q = hashmap_base_new(hash_ops, type HASHMAP_DEBUG_PASS_ARGS);
if (!q)
return -ENOMEM;
@@ -841,15 +841,15 @@ static int hashmap_base_ensure_allocated(HashmapBase **h, const struct hash_ops
}
int internal_hashmap_ensure_allocated(Hashmap **h, const struct hash_ops *hash_ops HASHMAP_DEBUG_PARAMS) {
- return hashmap_base_ensure_allocated((HashmapBase**)h, hash_ops, HASHMAP_TYPE_PLAIN HASHMAP_DEBUG_PASS_ARGS);
+ return hashmap_base_ensure_allocated((HashmapBase**)h, hash_ops, HASHMAP_TYPE_PLAIN HASHMAP_DEBUG_PASS_ARGS);
}
int internal_ordered_hashmap_ensure_allocated(OrderedHashmap **h, const struct hash_ops *hash_ops HASHMAP_DEBUG_PARAMS) {
- return hashmap_base_ensure_allocated((HashmapBase**)h, hash_ops, HASHMAP_TYPE_ORDERED HASHMAP_DEBUG_PASS_ARGS);
+ return hashmap_base_ensure_allocated((HashmapBase**)h, hash_ops, HASHMAP_TYPE_ORDERED HASHMAP_DEBUG_PASS_ARGS);
}
int internal_set_ensure_allocated(Set **s, const struct hash_ops *hash_ops HASHMAP_DEBUG_PARAMS) {
- return hashmap_base_ensure_allocated((HashmapBase**)s, hash_ops, HASHMAP_TYPE_SET HASHMAP_DEBUG_PASS_ARGS);
+ return hashmap_base_ensure_allocated((HashmapBase**)s, hash_ops, HASHMAP_TYPE_SET HASHMAP_DEBUG_PASS_ARGS);
}
static void hashmap_free_no_clear(HashmapBase *h) {
@@ -995,7 +995,6 @@ static bool hashmap_put_robin_hood(HashmapBase *h, unsigned idx,
if (dib < distance) {
/* Found a wealthier entry. Go Robin Hood! */
-
bucket_set_dib(h, idx, distance);
/* swap the entries */
commit e987f2a809c6bab7e7bae4ca8f598ea5bafd5225
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Sun Apr 12 11:52:06 2015 -0400
sysv-generator: always log on oom
This code appears to follow the following convention:
- all errors are logged at point of origin
- oom errors abort execution, non-oom errors are logged but
execution continues.
Make sure all ooms result in a log message, and remove warning which could
not be reached. Downgrade non-fatal errors to warnings.
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index aa5c98f..ea32164 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -330,7 +330,7 @@ static int handle_provides(SysvStub *s, unsigned line, const char *full_text, co
n = strndup(word, z);
if (!n)
- return -ENOMEM;
+ return log_oom();
r = sysv_translate_facility(n, basename(s->path), &m);
if (r < 0)
@@ -341,6 +341,10 @@ static int handle_provides(SysvStub *s, unsigned line, const char *full_text, co
if (unit_name_to_type(m) == UNIT_SERVICE) {
log_debug("Adding Provides: alias '%s' for '%s'", m, s->name);
r = add_alias(s->name, m);
+ if (r < 0)
+ log_unit_warning_errno(s->name, r,
+ "[%s:%u] Failed to add LSB Provides name %s, ignoring: %m",
+ s->path, line, m);
} else {
/* NB: SysV targets which are provided by a
* service are pulled in by the services, as
@@ -359,11 +363,6 @@ static int handle_provides(SysvStub *s, unsigned line, const char *full_text, co
return log_oom();
}
}
-
- if (r < 0)
- log_unit_error(s->name,
- "[%s:%u] Failed to add LSB Provides name %s, ignoring: %s",
- s->path, line, m, strerror(-r));
}
if (!isempty(state_))
log_unit_error(s->name,
@@ -383,16 +382,15 @@ static int handle_dependencies(SysvStub *s, unsigned line, const char *full_text
n = strndup(word, z);
if (!n)
- return -ENOMEM;
+ return log_oom();
r = sysv_translate_facility(n, basename(s->path), &m);
if (r < 0) {
- log_unit_error(s->name,
- "[%s:%u] Failed to translate LSB dependency %s, ignoring: %s",
- s->path, line, n, strerror(-r));
+ log_unit_warning_errno(s->name, r,
+ "[%s:%u] Failed to translate LSB dependency %s, ignoring: %m",
+ s->path, line, n);
continue;
}
-
if (r == 0)
continue;
@@ -404,23 +402,16 @@ static int handle_dependencies(SysvStub *s, unsigned line, const char *full_text
if (r < 0)
return log_oom();
r = strv_extend(&s->wants, m);
- if (r < 0)
- return log_oom();
- } else {
+ } else
r = strv_extend(is_before ? &s->before : &s->after, m);
- if (r < 0)
- return log_oom();
- }
if (r < 0)
- log_unit_error(s->name,
- "[%s:%u] Failed to add dependency on %s, ignoring: %s",
- s->path, line, m, strerror(-r));
+ return log_oom();
}
if (!isempty(state_))
- log_unit_error(s->name,
- "[%s:%u] Trailing garbage in %*s, ignoring.",
- s->path, line, (int)(strchr(full_text, ':') - full_text), full_text);
+ log_unit_warning(s->name,
+ "[%s:%u] Trailing garbage in %*s, ignoring.",
+ s->path, line, (int)(strchr(full_text, ':') - full_text), full_text);
return 0;
}
@@ -454,10 +445,9 @@ static int load_sysv(SysvStub *s) {
if (feof(f))
break;
- log_unit_error(s->name,
- "Failed to read configuration file '%s': %m",
- s->path);
- return -errno;
+ return log_unit_error_errno(s->name, errno,
+ "Failed to read configuration file '%s': %m",
+ s->path);
}
line++;
commit 1e2fee5f757c0bb3a6fea216b1e10ee7b3c0e12e
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Sun Apr 12 11:17:22 2015 -0400
sysv-generator: split out two nested blocks into functions
No functional change intended. Just splitting this out to make
it easier to edit in the future.
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index 4ab8f61..aa5c98f 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -320,6 +320,110 @@ finish:
return 1;
}
+static int handle_provides(SysvStub *s, unsigned line, const char *full_text, const char *text) {
+ const char *word, *state_;
+ size_t z;
+ int r;
+
+ FOREACH_WORD_QUOTED(word, z, text, state_) {
+ _cleanup_free_ char *n = NULL, *m = NULL;
+
+ n = strndup(word, z);
+ if (!n)
+ return -ENOMEM;
+
+ r = sysv_translate_facility(n, basename(s->path), &m);
+ if (r < 0)
+ return r;
+ if (r == 0)
+ continue;
+
+ if (unit_name_to_type(m) == UNIT_SERVICE) {
+ log_debug("Adding Provides: alias '%s' for '%s'", m, s->name);
+ r = add_alias(s->name, m);
+ } else {
+ /* NB: SysV targets which are provided by a
+ * service are pulled in by the services, as
+ * an indication that the generic service is
+ * now available. This is strictly one-way.
+ * The targets do NOT pull in SysV services! */
+ r = strv_extend(&s->before, m);
+ if (r < 0)
+ return log_oom();
+ r = strv_extend(&s->wants, m);
+ if (r < 0)
+ return log_oom();
+ if (streq(m, SPECIAL_NETWORK_ONLINE_TARGET)) {
+ r = strv_extend(&s->before, SPECIAL_NETWORK_TARGET);
+ if (r < 0)
+ return log_oom();
+ }
+ }
+
+ if (r < 0)
+ log_unit_error(s->name,
+ "[%s:%u] Failed to add LSB Provides name %s, ignoring: %s",
+ s->path, line, m, strerror(-r));
+ }
+ if (!isempty(state_))
+ log_unit_error(s->name,
+ "[%s:%u] Trailing garbage in Provides, ignoring.",
+ s->path, line);
+ return 0;
+}
+
+static int handle_dependencies(SysvStub *s, unsigned line, const char *full_text, const char *text) {
+ const char *word, *state_;
+ size_t z;
+ int r;
+
+ FOREACH_WORD_QUOTED(word, z, text, state_) {
+ _cleanup_free_ char *n = NULL, *m = NULL;
+ bool is_before;
+
+ n = strndup(word, z);
+ if (!n)
+ return -ENOMEM;
+
+ r = sysv_translate_facility(n, basename(s->path), &m);
+ if (r < 0) {
+ log_unit_error(s->name,
+ "[%s:%u] Failed to translate LSB dependency %s, ignoring: %s",
+ s->path, line, n, strerror(-r));
+ continue;
+ }
+
+ if (r == 0)
+ continue;
+
+ is_before = startswith_no_case(full_text, "X-Start-Before:");
+
+ if (streq(m, SPECIAL_NETWORK_ONLINE_TARGET) && !is_before) {
+ /* the network-online target is special, as it needs to be actively pulled in */
+ r = strv_extend(&s->after, m);
+ if (r < 0)
+ return log_oom();
+ r = strv_extend(&s->wants, m);
+ if (r < 0)
+ return log_oom();
+ } else {
+ r = strv_extend(is_before ? &s->before : &s->after, m);
+ if (r < 0)
+ return log_oom();
+ }
+
+ if (r < 0)
+ log_unit_error(s->name,
+ "[%s:%u] Failed to add dependency on %s, ignoring: %s",
+ s->path, line, m, strerror(-r));
+ }
+ if (!isempty(state_))
+ log_unit_error(s->name,
+ "[%s:%u] Trailing garbage in %*s, ignoring.",
+ s->path, line, (int)(strchr(full_text, ':') - full_text), full_text);
+ return 0;
+}
+
static int load_sysv(SysvStub *s) {
_cleanup_fclose_ FILE *f;
unsigned line = 0;
@@ -471,126 +575,22 @@ static int load_sysv(SysvStub *s) {
} else if (state == LSB || state == LSB_DESCRIPTION) {
if (startswith_no_case(t, "Provides:")) {
- const char *word, *state_;
- size_t z;
-
state = LSB;
- FOREACH_WORD_QUOTED(word, z, t+9, state_) {
- _cleanup_free_ char *n = NULL, *m = NULL;
-
- n = strndup(word, z);
- if (!n)
- return -ENOMEM;
-
- r = sysv_translate_facility(n, basename(s->path), &m);
- if (r < 0)
- return r;
- if (r == 0)
- continue;
-
- if (unit_name_to_type(m) == UNIT_SERVICE) {
- log_debug("Adding Provides: alias '%s' for '%s'", m, s->name);
- r = add_alias(s->name, m);
- } else {
- /* NB: SysV targets
- * which are provided
- * by a service are
- * pulled in by the
- * services, as an
- * indication that the
- * generic service is
- * now available. This
- * is strictly
- * one-way. The
- * targets do NOT pull
- * in the SysV
- * services! */
- r = strv_extend(&s->before, m);
- if (r < 0)
- return log_oom();
- r = strv_extend(&s->wants, m);
- if (r < 0)
- return log_oom();
- if (streq(m, SPECIAL_NETWORK_ONLINE_TARGET)) {
- r = strv_extend(&s->before, SPECIAL_NETWORK_TARGET);
- if (r < 0)
- return log_oom();
- }
- }
-
- if (r < 0)
- log_unit_error(s->name,
- "[%s:%u] Failed to add LSB Provides name %s, ignoring: %s",
- s->path, line, m, strerror(-r));
- }
- if (!isempty(state_))
- log_unit_error(s->name,
- "[%s:%u] Trailing garbage in Provides, ignoring.",
- s->path, line);
-
+ r = handle_provides(s, line, t, t + 9);
+ if (r < 0)
+ return r;
} else if (startswith_no_case(t, "Required-Start:") ||
startswith_no_case(t, "Should-Start:") ||
startswith_no_case(t, "X-Start-Before:") ||
startswith_no_case(t, "X-Start-After:")) {
- const char *word, *state_;
- size_t z;
state = LSB;
- FOREACH_WORD_QUOTED(word, z, strchr(t, ':')+1, state_) {
- _cleanup_free_ char *n = NULL, *m = NULL;
- bool is_before;
-
- n = strndup(word, z);
- if (!n)
- return -ENOMEM;
-
- r = sysv_translate_facility(n, basename(s->path), &m);
- if (r < 0) {
- log_unit_error(s->name,
- "[%s:%u] Failed to translate LSB dependency %s, ignoring: %s",
- s->path, line, n, strerror(-r));
- continue;
- }
+ r = handle_dependencies(s, line, t, strchr(t, ':') + 1);
+ if (r < 0)
+ return r;
- if (r == 0)
- continue;
-
- is_before = startswith_no_case(t, "X-Start-Before:");
-
- if (streq(m, SPECIAL_NETWORK_ONLINE_TARGET) && !is_before) {
- /* the network-online target is special, as it needs to be actively pulled in */
- r = strv_extend(&s->after, m);
- if (r < 0)
- return log_oom();
- r = strv_extend(&s->wants, m);
- if (r < 0)
- return log_oom();
- }
- else {
- if (is_before) {
- r = strv_extend(&s->before, m);
- if (r < 0)
- return log_oom();
- }
- else {
- r = strv_extend(&s->after, m);
- if (r < 0)
- return log_oom();
- }
- }
-
- if (r < 0)
- log_unit_error(s->name,
- "[%s:%u] Failed to add dependency on %s, ignoring: %s",
- s->path, line, m, strerror(-r));
- }
- if (!isempty(state_))
- log_unit_error(s->name,
- "[%s:%u] Trailing garbage in %*s, ignoring.",
- s->path, line,
- (int)(strchr(t, ':') - t), t);
} else if (startswith_no_case(t, "Description:")) {
char *d, *j;
More information about the systemd-commits
mailing list