From ba2098a2d6f7b90beb4ede5fb2c80cc66a79284d Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Thu, 19 May 2022 15:07:46 -0700 Subject: [PATCH] package/cpulimit: backport a fix for an infrequent crash Backport the fix submitted from this pull request: https://github.com/opsengine/cpulimit/pull/61 to fix an infrequent crash. Signed-off-by: Florian Fainelli Signed-off-by: Thomas Petazzoni --- .../0003-Fix-an-infrequent-crash.patch | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 package/cpulimit/0003-Fix-an-infrequent-crash.patch diff --git a/package/cpulimit/0003-Fix-an-infrequent-crash.patch b/package/cpulimit/0003-Fix-an-infrequent-crash.patch new file mode 100644 index 0000000000..a19fb6e304 --- /dev/null +++ b/package/cpulimit/0003-Fix-an-infrequent-crash.patch @@ -0,0 +1,26 @@ +From 512998f967a9dab5e98010e1043985fc855d9f4e Mon Sep 17 00:00:00 2001 +From: Pavel Timofeev +Date: Thu, 14 Jul 2016 13:50:35 +0300 +Subject: [PATCH] Fix an infrequent crash + +Signed-off-by: Florian Fainelli +[Upstream: https://github.com/opsengine/cpulimit/pull/61] +--- + src/process_iterator_linux.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/process_iterator_linux.c b/src/process_iterator_linux.c +index c8cdd07adcbe..93b44bab1755 100644 +--- a/src/process_iterator_linux.c ++++ b/src/process_iterator_linux.c +@@ -98,6 +98,7 @@ static int read_process_info(pid_t pid, struct process *p) + //read command line + sprintf(exefile,"/proc/%d/cmdline", p->pid); + fd = fopen(exefile, "r"); ++ if (fd==NULL) return -1; + if (fgets(buffer, sizeof(buffer), fd)==NULL) { + fclose(fd); + return -1; +-- +2.25.1 +