summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-12-06 19:36:30 +0100
committerLennart Poettering <lennart@poettering.net>2016-12-14 18:29:30 +0100
commite932f5407ef5ad05d25d7dfefa4cda0fe81cc346 (patch)
tree52d0ad8de8df9ae6753d79c3e632a4be68076d98 /src
parent61f638e5446d0d4a5b5e7f81c174e4f072bd01f7 (diff)
sysv-generator: properly translate sysv facilities
We used the wrong return value in one case, so that our translations were thrown away. While we are at it, make sure to always initialize *ret on successful function exits. Fixes: #4762
Diffstat (limited to 'src')
-rw-r--r--src/sysv-generator/sysv-generator.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index 921fd478d0..9fde9b1884 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -292,8 +292,10 @@ static int sysv_translate_facility(SysvStub *s, unsigned line, const char *name,
if (!streq(table[i], n))
continue;
- if (!table[i+1])
+ if (!table[i+1]) {
+ *ret = NULL;
return 0;
+ }
m = strdup(table[i+1]);
if (!m)
@@ -312,7 +314,7 @@ static int sysv_translate_facility(SysvStub *s, unsigned line, const char *name,
if (r < 0)
return log_error_errno(r, "[%s:%u] Could not build name for facility %s: %m", s->path, line, name);
- return r;
+ return 1;
}
/* Strip ".sh" suffix from file name for comparison */
@@ -324,8 +326,10 @@ static int sysv_translate_facility(SysvStub *s, unsigned line, const char *name,
}
/* Names equaling the file name of the services are redundant */
- if (streq_ptr(n, filename))
+ if (streq_ptr(n, filename)) {
+ *ret = NULL;
return 0;
+ }
/* Everything else we assume to be normal service names */
m = sysv_translate_name(n);