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

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