summaryrefslogtreecommitdiffstats
path: root/libcutils/sched_policy.cpp
diff options
context:
space:
mode:
authorWei Wang <wvw@google.com>2017-03-20 15:13:05 -0700
committerWei Wang <wvw@google.com>2017-03-20 22:13:22 -0700
commit97957fc420b0d2dc019f4728b2d3611b7305ab91 (patch)
treee4e94dcc44f84ccf6c52124e758df2df55cede7c /libcutils/sched_policy.cpp
parenta27a91a5fd23730c9ef0af751cddf119d869e029 (diff)
downloadsystem_core-97957fc420b0d2dc019f4728b2d3611b7305ab91.tar.gz
system_core-97957fc420b0d2dc019f4728b2d3611b7305ab91.tar.bz2
system_core-97957fc420b0d2dc019f4728b2d3611b7305ab91.zip
libcutils: only change cgroup when fd is initialized
This is to avoid failues on setting non-exist cgroup Bug: 34193533 Test: on marlin Change-Id: I619dcba332fda9ec421df811745cf10311beddd3
Diffstat (limited to 'libcutils/sched_policy.cpp')
-rw-r--r--libcutils/sched_policy.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libcutils/sched_policy.cpp b/libcutils/sched_policy.cpp
index 7e3ad593e..40144cf16 100644
--- a/libcutils/sched_policy.cpp
+++ b/libcutils/sched_policy.cpp
@@ -464,7 +464,7 @@ int set_sched_policy(int tid, SchedPolicy policy)
break;
}
- 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;
}