X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fswap.c;h=202c4e6625fb0e986693880c41bf8b888a178f64;hp=afc0c5faab55a6d6fd42d4374f2d378a8c2ec784;hb=7d17cfbc46306a106dbda0f3e92fbc0792d1e9e9;hpb=f975e971accc4d50c73ae53167db3df7a7099cf2 diff --git a/src/swap.c b/src/swap.c index afc0c5faa..202c4e662 100644 --- a/src/swap.c +++ b/src/swap.c @@ -74,7 +74,7 @@ static void swap_unset_proc_swaps(Swap *s) { s->parameters_proc_swaps.what = NULL; } - static void swap_init(Unit *u) { +static void swap_init(Unit *u) { Swap *s = SWAP(u); assert(s); @@ -83,7 +83,8 @@ static void swap_unset_proc_swaps(Swap *s) { s->timeout_usec = DEFAULT_TIMEOUT_USEC; exec_context_init(&s->exec_context); - s->exec_context.std_output = EXEC_OUTPUT_KMSG; + s->exec_context.std_output = u->meta.manager->default_std_output; + s->exec_context.std_error = u->meta.manager->default_std_error; s->parameters_etc_fstab.priority = s->parameters_proc_swaps.priority = s->parameters_fragment.priority = -1; @@ -333,7 +334,8 @@ int swap_add_one( assert(m); assert(what); - if (!(e = unit_name_from_path(what, ".swap"))) + e = unit_name_from_path(what, ".swap"); + if (!e) return -ENOMEM; u = manager_get_unit(m, e); @@ -347,15 +349,18 @@ int swap_add_one( if (!u) { delete = true; - if (!(u = unit_new(m))) { + u = unit_new(m, sizeof(Swap)); + if (!u) { free(e); return -ENOMEM; } - if ((r = unit_add_name(u, e)) < 0) + r = unit_add_name(u, e); + if (r < 0) goto fail; - if (!(SWAP(u)->what = strdup(what))) { + SWAP(u)->what = strdup(what); + if (!SWAP(u)->what) { r = -ENOMEM; goto fail; } @@ -613,6 +618,7 @@ static int swap_spawn(Swap *s, ExecCommand *c, pid_t *_pid) { true, s->meta.manager->confirm_spawn, s->meta.cgroup_bondings, + s->meta.cgroup_attributes, &pid)) < 0) goto fail; @@ -1339,6 +1345,7 @@ DEFINE_STRING_TABLE_LOOKUP(swap_exec_command, SwapExecCommand); const UnitVTable swap_vtable = { .suffix = ".swap", + .object_size = sizeof(Swap), .sections = "Unit\0" "Swap\0"