]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cgroup-util: fix enabling of controllers (#8816)
authorAntique <phrdina@redhat.com>
Thu, 26 Apr 2018 10:37:35 +0000 (12:37 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 26 Apr 2018 10:37:35 +0000 (12:37 +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 b5b0d584858d54307cf6fce19c83dafcf8baa316..1b0221edc4ea1e77603b42a2e870424f163f94e5 100644 (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);
+                        }
                 }
         }