diff options
author | Colin Cross <ccross@android.com> | 2015-04-30 15:12:21 -0700 |
---|---|---|
committer | Ying Wang <wangying@google.com> | 2015-06-09 12:44:41 -0700 |
commit | 20bbd4f44943bb8c8f0097790d1c8d6051760fda (patch) | |
tree | 951dddc6eac8367880599fa3586fa20429f9d531 /base | |
parent | dca1bb5e79e197676356f374939b7ca5dfd1a195 (diff) | |
download | system_core-20bbd4f44943bb8c8f0097790d1c8d6051760fda.zip system_core-20bbd4f44943bb8c8f0097790d1c8d6051760fda.tar.gz system_core-20bbd4f44943bb8c8f0097790d1c8d6051760fda.tar.bz2 |
Fix comparison between signed and unsigned error on darwin
mode_t is a uint16_t on darwin, which causes
sb.st_mode & ~S_IFMT
to produce an int when the uint16_t is promoted for the operator.
Cast to unsigned int before comparing against 0660U.
Change-Id: Ib1439c08d9e2b297eeeba701891508d269c19a3d
(cherry-pick from commit 56b37345d99f2cd85720f6b1aa1934fa3bfe29a6)
Diffstat (limited to 'base')
-rw-r--r-- | base/file_test.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/base/file_test.cpp b/base/file_test.cpp index e5cf696..5445a0d 100644 --- a/base/file_test.cpp +++ b/base/file_test.cpp @@ -60,7 +60,7 @@ TEST(file, WriteStringToFile2) { << errno; struct stat sb; ASSERT_EQ(0, stat(tf.filename, &sb)); - ASSERT_EQ(0660U, (sb.st_mode & ~S_IFMT)); + ASSERT_EQ(0660U, static_cast<unsigned int>(sb.st_mode & ~S_IFMT)); ASSERT_EQ(getuid(), sb.st_uid); ASSERT_EQ(getgid(), sb.st_gid); std::string s; |