Blame SOURCES/libcgroup-0.41-tasks-file-warning.patch
|
|
2ae3c9 |
From 437b68f34c459d136c806e61dafb5825d2f97170 Mon Sep 17 00:00:00 2001
|
|
|
2ae3c9 |
From: =?UTF-8?q?Nikola=20Forr=C3=B3?= <nforro@redhat.com>
|
|
|
2ae3c9 |
Date: Tue, 17 Apr 2018 13:32:28 +0200
|
|
|
2ae3c9 |
Subject: [PATCH 4/6] api.c: Show warning when tasks file can not be opened
|
|
|
2ae3c9 |
MIME-Version: 1.0
|
|
|
2ae3c9 |
Content-Type: text/plain; charset=UTF-8
|
|
|
2ae3c9 |
Content-Transfer-Encoding: 8bit
|
|
|
2ae3c9 |
|
|
|
2ae3c9 |
Signed-off-by: Nikola Forró <nforro@redhat.com>
|
|
|
2ae3c9 |
---
|
|
|
2ae3c9 |
src/api.c | 12 ++++++++----
|
|
|
2ae3c9 |
1 file changed, 8 insertions(+), 4 deletions(-)
|
|
|
2ae3c9 |
|
|
|
2ae3c9 |
diff --git a/src/api.c b/src/api.c
|
|
|
2ae3c9 |
index 4d98081..51081b4 100644
|
|
|
2ae3c9 |
--- a/src/api.c
|
|
|
2ae3c9 |
+++ b/src/api.c
|
|
|
2ae3c9 |
@@ -1190,12 +1190,15 @@ static int __cgroup_attach_task_pid(char *path, pid_t tid)
|
|
|
2ae3c9 |
if (!tasks) {
|
|
|
2ae3c9 |
switch (errno) {
|
|
|
2ae3c9 |
case EPERM:
|
|
|
2ae3c9 |
- return ECGROUPNOTOWNER;
|
|
|
2ae3c9 |
+ ret = ECGROUPNOTOWNER;
|
|
|
2ae3c9 |
+ break;
|
|
|
2ae3c9 |
case ENOENT:
|
|
|
2ae3c9 |
- return ECGROUPNOTEXIST;
|
|
|
2ae3c9 |
+ ret = ECGROUPNOTEXIST;
|
|
|
2ae3c9 |
+ break;
|
|
|
2ae3c9 |
default:
|
|
|
2ae3c9 |
- return ECGROUPNOTALLOWED;
|
|
|
2ae3c9 |
+ ret = ECGROUPNOTALLOWED;
|
|
|
2ae3c9 |
}
|
|
|
2ae3c9 |
+ goto err;
|
|
|
2ae3c9 |
}
|
|
|
2ae3c9 |
ret = fprintf(tasks, "%d", tid);
|
|
|
2ae3c9 |
if (ret < 0) {
|
|
|
2ae3c9 |
@@ -1214,7 +1217,8 @@ static int __cgroup_attach_task_pid(char *path, pid_t tid)
|
|
|
2ae3c9 |
err:
|
|
|
2ae3c9 |
cgroup_warn("Warning: cannot write tid %d to %s:%s\n",
|
|
|
2ae3c9 |
tid, path, strerror(errno));
|
|
|
2ae3c9 |
- fclose(tasks);
|
|
|
2ae3c9 |
+ if (tasks)
|
|
|
2ae3c9 |
+ fclose(tasks);
|
|
|
2ae3c9 |
return ret;
|
|
|
2ae3c9 |
}
|
|
|
2ae3c9 |
|
|
|
2ae3c9 |
--
|
|
|
2ae3c9 |
2.17.0
|
|
|
2ae3c9 |
|