From f4ae42f6a83cd4edaf90df4f509550e4690d6998 Mon Sep 17 00:00:00 2001 From: Jorge Lucangeli Obes Date: Thu, 12 Jan 2017 15:42:22 -0500 Subject: [PATCH] Check the return value of setuid(2). I'd like to mark setuid() WARN_UNUSED_RESULT to prevent security bugs. This line would break because the file is compiled with -Werror. Bug: 34251640 Test: Build, run unit test. Change-Id: Ibb6fa5e5b899d47f77f2a32da762165de310101d --- liblog/tests/liblog_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/liblog/tests/liblog_test.cpp b/liblog/tests/liblog_test.cpp index 02feb9767..ec0352eea 100644 --- a/liblog/tests/liblog_test.cpp +++ b/liblog/tests/liblog_test.cpp @@ -1831,7 +1831,7 @@ TEST(liblog, __security_buffer) { return; } - setuid(AID_SYSTEM); // only one that can read security buffer + EXPECT_EQ(0, setuid(AID_SYSTEM)); // only one that can read security buffer pid_t pid = getpid();