diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-09-18 11:40:01 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-09-18 11:40:01 +0200 |
commit | 3ef63c317481c2b3f1fe39e1b0f130aac3544522 (patch) | |
tree | 0a6bb8b1566591bb7cf6d51fcb085493688efa4a /src/core/unit.c | |
parent | 41f9172f427bdbb8221c64029f78364b8dd4e527 (diff) |
unit-printf: before resolving exec context specifiers check whether the object actually has an exec context
Diffstat (limited to 'src/core/unit.c')
-rw-r--r-- | src/core/unit.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/unit.c b/src/core/unit.c index 4eea5b57ae..1e33936346 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -2684,6 +2684,17 @@ int unit_exec_context_defaults(Unit *u, ExecContext *c) { return 0; } +ExecContext *unit_get_exec_context(Unit *u) { + size_t offset; + assert(u); + + offset = UNIT_VTABLE(u)->exec_context_offset; + if (offset <= 0) + return NULL; + + return (ExecContext*) ((uint8_t*) u + offset); +} + static const char* const unit_active_state_table[_UNIT_ACTIVE_STATE_MAX] = { [UNIT_ACTIVE] = "active", [UNIT_RELOADING] = "reloading", |