summaryrefslogtreecommitdiff
path: root/src/shared/dropin.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-06-30 18:41:17 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-06-30 18:41:17 -0400
commit8eea868708923a092ee85d6146ba4c04b7baea06 (patch)
treefcbb03789d329522d5ef87242608fa6467595b62 /src/shared/dropin.c
parentb3208b662948b51ff34e7b7752e28ec7a48708ae (diff)
cryptsetup: allow x-systemd.device-timeout
https://bugs.freedesktop.org/show_bug.cgi?id=54210
Diffstat (limited to 'src/shared/dropin.c')
-rw-r--r--src/shared/dropin.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/shared/dropin.c b/src/shared/dropin.c
index 7774236f71..ac09be984a 100644
--- a/src/shared/dropin.c
+++ b/src/shared/dropin.c
@@ -24,17 +24,21 @@
#include "mkdir.h"
#include "fileio-label.h"
-int drop_in_file(const char *dir, const char *unit,
+int drop_in_file(const char *dir, const char *unit, unsigned level,
const char *name, char **_p, char **_q) {
_cleanup_free_ char *b = NULL;
char *p, *q;
+ char prefix[DECIMAL_STR_MAX(unsigned)];
+
assert(unit);
assert(name);
assert(_p);
assert(_q);
+ sprintf(prefix, "%u", level);
+
b = xescape(name, "/.");
if (!b)
return -ENOMEM;
@@ -46,7 +50,7 @@ int drop_in_file(const char *dir, const char *unit,
if (!p)
return -ENOMEM;
- q = strjoin(p, "/90-", b, ".conf", NULL);
+ q = strjoin(p, "/", prefix, "-", b, ".conf", NULL);
if (!q) {
free(p);
return -ENOMEM;
@@ -57,7 +61,7 @@ int drop_in_file(const char *dir, const char *unit,
return 0;
}
-int write_drop_in(const char *dir, const char *unit,
+int write_drop_in(const char *dir, const char *unit, unsigned level,
const char *name, const char *data) {
_cleanup_free_ char *p = NULL, *q = NULL;
@@ -68,7 +72,7 @@ int write_drop_in(const char *dir, const char *unit,
assert(name);
assert(data);
- r = drop_in_file(dir, unit, name, &p, &q);
+ r = drop_in_file(dir, unit, level, name, &p, &q);
if (r < 0)
return r;
@@ -76,7 +80,7 @@ int write_drop_in(const char *dir, const char *unit,
return write_string_file_atomic_label(q, data);
}
-int write_drop_in_format(const char *dir, const char *unit,
+int write_drop_in_format(const char *dir, const char *unit, unsigned level,
const char *name, const char *format, ...) {
_cleanup_free_ char *p = NULL;
va_list ap;
@@ -94,5 +98,5 @@ int write_drop_in_format(const char *dir, const char *unit,
if (r < 0)
return -ENOMEM;
- return write_drop_in(dir, unit, name, p);
+ return write_drop_in(dir, unit, level, name, p);
}