chiark / gitweb /
cgroup-util: fix enabling of controllers (#8816)
authorAntique <phrdina@redhat.com>
Thu, 26 Apr 2018 10:37:35 +0000 (12:37 +0200)
committerSven Eden <yamakuzure@gmx.net>
Fri, 24 Aug 2018 14:47:08 +0000 (16:47 +0200)
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>
src/basic/cgroup-util.c

index 1c5ca9899406860a58469071ad50108c1c550059..0570e9abfb664d892de7ee448401006b669e03e3 100644 (file)
@@ -2718,8 +2718,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);
+                        }
                 }
         }