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; }