From 044be6bceb1bfd706a550805e10d8e208ecfa903 Mon Sep 17 00:00:00 2001 From: Greg Kaiser Date: Tue, 8 Feb 2022 07:37:13 -0800 Subject: [PATCH] libutils: Remove a little dead code With our recent change 0455a2c39c781a8153c1090a4638193b4181379d, there's some logic that can be simplified to make this slightly easier to read. This CL does not change the behavior of this code. Bug: 208895940 Test: TreeHugger Change-Id: I4de2dbaf4406cbb7785df8839bb3ae453186ea69 --- libutils/Threads.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/libutils/Threads.cpp b/libutils/Threads.cpp index a85ff20bc..4dacdc6ce 100644 --- a/libutils/Threads.cpp +++ b/libutils/Threads.cpp @@ -299,21 +299,16 @@ void androidSetCreateThreadFunc(android_create_thread_fn func) int androidSetThreadPriority(pid_t tid, int pri) { int rc = 0; - int lasterr = 0; int curr_pri = getpriority(PRIO_PROCESS, tid); if (curr_pri == pri) { return rc; } - if (rc) { - lasterr = errno; - } - if (setpriority(PRIO_PROCESS, tid, pri) < 0) { rc = INVALID_OPERATION; } else { - errno = lasterr; + errno = 0; } return rc;