diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 03:50:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 03:50:42 +0000 |
commit | 78e9bb837c258ac0ec7712b3d612cc2f407e731e (patch) | |
tree | f515d16b6efd858a9aeb5b0ef5d6f90bf288283d /src/shared/dropin.c | |
parent | Adding debian version 255.5-1. (diff) | |
download | systemd-78e9bb837c258ac0ec7712b3d612cc2f407e731e.tar.xz systemd-78e9bb837c258ac0ec7712b3d612cc2f407e731e.zip |
Merging upstream version 256.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/shared/dropin.c')
-rw-r--r-- | src/shared/dropin.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/shared/dropin.c b/src/shared/dropin.c index d46e838..9a786d0 100644 --- a/src/shared/dropin.c +++ b/src/shared/dropin.c @@ -26,7 +26,7 @@ int drop_in_file(const char *dir, const char *unit, unsigned level, const char *name, char **ret_p, char **ret_q) { - char prefix[DECIMAL_STR_MAX(unsigned)]; + char prefix[DECIMAL_STR_MAX(unsigned) + 1] = {}; _cleanup_free_ char *b = NULL, *p = NULL, *q = NULL; assert(unit); @@ -34,7 +34,8 @@ int drop_in_file(const char *dir, const char *unit, unsigned level, assert(ret_p); assert(ret_q); - sprintf(prefix, "%u", level); + if (level != UINT_MAX) + xsprintf(prefix, "%u-", level); b = xescape(name, "/."); if (!b) @@ -44,7 +45,7 @@ int drop_in_file(const char *dir, const char *unit, unsigned level, return -EINVAL; p = strjoin(dir, "/", unit, ".d"); - q = strjoin(p, "/", prefix, "-", b, ".conf"); + q = strjoin(p, "/", prefix, b, ".conf"); if (!p || !q) return -ENOMEM; |