summaryrefslogtreecommitdiff
path: root/src/core/unit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-02-17 01:58:33 +0100
committerLennart Poettering <lennart@poettering.net>2014-02-17 15:49:21 +0100
commit6d2357247b198314d972932415d65a42f83a9b6e (patch)
tree49652d794450fd48faf84d608fa8d00dd5373e82 /src/core/unit.c
parente954c9cfa687065244adebaa15314082ba6d7ec2 (diff)
core: fix property changes in transient units
Diffstat (limited to 'src/core/unit.c')
-rw-r--r--src/core/unit.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index 27d3be3860..d529638f86 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2860,7 +2860,6 @@ static int drop_in_file(Unit *u, UnitSetPropertiesMode mode, const char *name, c
assert(name);
assert(_p);
assert(_q);
- assert(mode & (UNIT_PERSISTENT|UNIT_RUNTIME));
b = xescape(name, "/.");
if (!b)
@@ -2879,7 +2878,7 @@ static int drop_in_file(Unit *u, UnitSetPropertiesMode mode, const char *name, c
return -ENOENT;
p = strjoin(c, "/", u->id, ".d", NULL);
- } else if (mode & UNIT_PERSISTENT)
+ } else if (mode == UNIT_PERSISTENT && !u->transient)
p = strjoin("/etc/systemd/system/", u->id, ".d", NULL);
else
p = strjoin("/run/systemd/system/", u->id, ".d", NULL);
@@ -2905,7 +2904,7 @@ int unit_write_drop_in(Unit *u, UnitSetPropertiesMode mode, const char *name, co
assert(name);
assert(data);
- if (!(mode & (UNIT_PERSISTENT|UNIT_RUNTIME)))
+ if (!IN_SET(mode, UNIT_PERSISTENT, UNIT_RUNTIME))
return 0;
r = drop_in_file(u, mode, name, &p, &q);
@@ -2925,7 +2924,7 @@ int unit_write_drop_in_format(Unit *u, UnitSetPropertiesMode mode, const char *n
assert(name);
assert(format);
- if (!(mode & (UNIT_PERSISTENT|UNIT_RUNTIME)))
+ if (!IN_SET(mode, UNIT_PERSISTENT, UNIT_RUNTIME))
return 0;
va_start(ap, format);
@@ -2948,7 +2947,7 @@ int unit_write_drop_in_private(Unit *u, UnitSetPropertiesMode mode, const char *
if (!UNIT_VTABLE(u)->private_section)
return -EINVAL;
- if (!(mode & (UNIT_PERSISTENT|UNIT_RUNTIME)))
+ if (!IN_SET(mode, UNIT_PERSISTENT, UNIT_RUNTIME))
return 0;
ndata = strjoin("[", UNIT_VTABLE(u)->private_section, "]\n", data, NULL);
@@ -2967,7 +2966,7 @@ int unit_write_drop_in_private_format(Unit *u, UnitSetPropertiesMode mode, const
assert(name);
assert(format);
- if (!(mode & (UNIT_PERSISTENT|UNIT_RUNTIME)))
+ if (!IN_SET(mode, UNIT_PERSISTENT, UNIT_RUNTIME))
return 0;
va_start(ap, format);
@@ -2986,7 +2985,7 @@ int unit_remove_drop_in(Unit *u, UnitSetPropertiesMode mode, const char *name) {
assert(u);
- if (!(mode & (UNIT_PERSISTENT|UNIT_RUNTIME)))
+ if (!IN_SET(mode, UNIT_PERSISTENT, UNIT_RUNTIME))
return 0;
r = drop_in_file(u, mode, name, &p, &q);