libcutils: only change cgroup when fd is initialized [ DO NOT MERGE ]
This is to avoid failues on setting non-exist cgroup
Bug: 34193533
Test: on marlin
Change-Id: I619dcba332fda9ec421df811745cf10311beddd3
(cherry picked from commit e46aae223626432bde7d4e95818e8394664c6c02)
diff --git a/libcutils/sched_policy.c b/libcutils/sched_policy.c
index 05a2048..6d90589 100644
--- a/libcutils/sched_policy.c
+++ b/libcutils/sched_policy.c
@@ -404,7 +404,7 @@
}
- if (add_tid_to_cgroup(tid, fd) != 0) {
+ if (fd > 0 && add_tid_to_cgroup(tid, fd) != 0) {
if (errno != ESRCH && errno != ENOENT)
return -errno;
}