ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
Blob Blame History Raw
From cde797e980fac7f8b1aa35db3f65fc591b820d62 Mon Sep 17 00:00:00 2001
From: Jan Synacek <jsynacek@redhat.com>
Date: Thu, 23 Nov 2017 09:27:06 +0100
Subject: [PATCH] cgroup-util: replace one use of fgets() by read_line()

(cherry picked from commit 2351e44d3ed57b7a48b9e544a59c3b797ac4d216)

Resolves: #1503106
---
 src/shared/cgroup-util.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c
index f67b53b4d..4585450b3 100644
--- a/src/shared/cgroup-util.c
+++ b/src/shared/cgroup-util.c
@@ -1747,7 +1747,6 @@ CGroupControllerMask cg_mask_supported(void) {
 
 int cg_kernel_controllers(Set *controllers) {
         _cleanup_fclose_ FILE *f = NULL;
-        char buf[LINE_MAX];
         int r;
 
         assert(controllers);
@@ -1760,7 +1759,7 @@ int cg_kernel_controllers(Set *controllers) {
         }
 
         /* Ignore the header line */
-        (void) fgets(buf, sizeof(buf), f);
+        (void) read_line(f, (size_t) -1, NULL);
 
         for (;;) {
                 char *controller;