cgroup-util: fix enabling of controllers (#8816)

If enabling controller for some reason fails we need to clear error
for the FILE stream.  Enabling remaining controllers would otherwise
fail because write_string_stream_ts() checks for ferror(f) and returns
-EIO if there is one.

Broken by commit <77fa610b22>.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Antique 2018-04-26 12:37:35 +02:00 committed by Zbigniew Jędrzejewski-Szmek
parent 8ac42236b0
commit 96aa6591d1
1 changed files with 3 additions and 1 deletions

View File

@ -2589,8 +2589,10 @@ int cg_enable_everywhere(CGroupMask supported, CGroupMask mask, const char *p) {
}
r = write_string_stream(f, s, 0);
if (r < 0)
if (r < 0) {
log_debug_errno(r, "Failed to enable controller %s for %s (%s): %m", n, p, fs);
clearerr(f);
}
}
}