mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-10-28 20:25:25 +03:00
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
This commit is contained in:
parent
61f638e544
commit
e932f5407e
@ -292,8 +292,10 @@ static int sysv_translate_facility(SysvStub *s, unsigned line, const char *name,
|
|||||||
if (!streq(table[i], n))
|
if (!streq(table[i], n))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!table[i+1])
|
if (!table[i+1]) {
|
||||||
|
*ret = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
m = strdup(table[i+1]);
|
m = strdup(table[i+1]);
|
||||||
if (!m)
|
if (!m)
|
||||||
@ -312,7 +314,7 @@ static int sysv_translate_facility(SysvStub *s, unsigned line, const char *name,
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "[%s:%u] Could not build name for facility %s: %m", s->path, line, name);
|
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 */
|
/* 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 */
|
/* Names equaling the file name of the services are redundant */
|
||||||
if (streq_ptr(n, filename))
|
if (streq_ptr(n, filename)) {
|
||||||
|
*ret = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Everything else we assume to be normal service names */
|
/* Everything else we assume to be normal service names */
|
||||||
m = sysv_translate_name(n);
|
m = sysv_translate_name(n);
|
||||||
|
Loading…
Reference in New Issue
Block a user