anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0582-cgroup-util-replace-one-use-of-fgets-by-read_line.patch

dd65c9
From cde797e980fac7f8b1aa35db3f65fc591b820d62 Mon Sep 17 00:00:00 2001
dd65c9
From: Jan Synacek <jsynacek@redhat.com>
dd65c9
Date: Thu, 23 Nov 2017 09:27:06 +0100
dd65c9
Subject: [PATCH] cgroup-util: replace one use of fgets() by read_line()
dd65c9
dd65c9
(cherry picked from commit 2351e44d3ed57b7a48b9e544a59c3b797ac4d216)
dd65c9
dd65c9
Resolves: #1503106
dd65c9
---
dd65c9
 src/shared/cgroup-util.c | 3 +--
dd65c9
 1 file changed, 1 insertion(+), 2 deletions(-)
dd65c9
dd65c9
diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c
dd65c9
index f67b53b4d..4585450b3 100644
dd65c9
--- a/src/shared/cgroup-util.c
dd65c9
+++ b/src/shared/cgroup-util.c
dd65c9
@@ -1747,7 +1747,6 @@ CGroupControllerMask cg_mask_supported(void) {
dd65c9
 
dd65c9
 int cg_kernel_controllers(Set *controllers) {
dd65c9
         _cleanup_fclose_ FILE *f = NULL;
dd65c9
-        char buf[LINE_MAX];
dd65c9
         int r;
dd65c9
 
dd65c9
         assert(controllers);
dd65c9
@@ -1760,7 +1759,7 @@ int cg_kernel_controllers(Set *controllers) {
dd65c9
         }
dd65c9
 
dd65c9
         /* Ignore the header line */
dd65c9
-        (void) fgets(buf, sizeof(buf), f);
dd65c9
+        (void) read_line(f, (size_t) -1, NULL);
dd65c9
 
dd65c9
         for (;;) {
dd65c9
                 char *controller;